Support Board
Date/Time: Sat, 11 Jan 2025 17:40:57 +0000
Post From: Setting sc.Subgraph[].TextDrawStyleText dynamically
[2016-12-11 16:23:09] |
binaryduke - Posts: 373 |
Thank you. I have tested based upon your example as below and I receive the same Index value displayed at the base of every bar, i.e. it is not displaying an incrementing value: #include "sierrachart.h" SCDLLName("TextDrawStyleTextTest") SCSFExport scsf_TemplateFunction1(SCStudyGraphRef sc) { // Set the configuration variables if (sc.SetDefaults) { sc.GraphName = "TextDrawStyleTextTest1"; sc.GraphRegion = 0; sc.AutoLoop = 1; // true // During development set this flag to 1, so the DLL can be rebuilt without restarting Sierra Chart. When development is completed, set it to 0 to improve performance. sc.FreeDLL = 0; sc.Subgraph[0].Name = "TextTest"; sc.Subgraph[0].DrawStyle = DRAWSTYLE_TEXT; return; } // Data processing SCString DisplayString; DisplayString.Format("%u", sc.Index); sc.Subgraph[0].TextDrawStyleText = DisplayString; sc.Subgraph[0][sc.Index] = sc.Low[sc.Index] - (2 * sc.TickSize); } I am aiming to display text that is conditional based upon the bar (or my indicator), i.e. #include "sierrachart.h" SCDLLName("TextDrawStyleTextTest") SCSFExport scsf_TemplateFunction1(SCStudyGraphRef sc) { // Set the configuration variables if (sc.SetDefaults) { sc.GraphName = "TextDrawStyleTextTest1"; sc.GraphRegion = 0; sc.AutoLoop = 1; // true // During development set this flag to 1, so the DLL can be rebuilt without restarting Sierra Chart. When development is completed, set it to 0 to improve performance. sc.FreeDLL = 0; sc.Subgraph[0].Name = "TextTest"; sc.Subgraph[0].DrawStyle = DRAWSTYLE_TEXT; return; } // Data processing SCString DisplayString; // Display a string based upon the last price in the bar if (sc.Close[sc.Index] == sc.Close[sc.Index - 1]) { DisplayString = "Unchanged"; } else if (sc.Close[sc.Index] > sc.Close[sc.Index - 1]) { DisplayString = "Higher"; } else { DisplayString = "Lower"; } sc.Subgraph[0].TextDrawStyleText = DisplayString; sc.Subgraph[0][sc.Index] = sc.Low[sc.Index] - (2 * sc.TickSize); } however as with the code based upon your example, this repeats a single string for every bar based upon the conditional result of the first bar. Am I missing something based upon AutoLoop perhaps? Date Time Of Last Edit: 2016-12-11 16:37:08
|