Support Board
Date/Time: Fri, 21 Feb 2025 18:38:40 +0000
[Programming Help] - ACSIL new text updating on top of prior text values
View Count: 531
[2021-01-26 13:15:10] |
grantx - Posts: 244 |
In the following code I am getting the highest and lowest values and assigning the text to sc.AddAndManageSingleTextDrawingForStudy. However, the text is unreadable because it keeps writing the latest text on top of previous text. It must either blank that textbox and update with the latest OR only populate it once on the last bar and never again. How would I achieve this? SCSFExport scsf_test_V1(SCStudyInterfaceRef sc) { SCInputRef Input_Price = sc.Input[0]; SCInputRef Input_Period = sc.Input[1]; SCSubgraphRef Subgraph_TextDisplay = sc.Subgraph[1]; if (sc.SetDefaults) { // Set the defaults sc.GraphName = "test 1"; Subgraph_TextDisplay.Name = "Text Display"; Subgraph_TextDisplay.LineWidth = 10; Subgraph_TextDisplay.DrawStyle = DRAWSTYLE_CUSTOM_TEXT; Subgraph_TextDisplay.PrimaryColor = RGB(255, 255, 255); //white Subgraph_TextDisplay.SecondaryColor = RGB(128, 255, 255); Subgraph_TextDisplay.SecondaryColorUsed = true; Subgraph_TextDisplay.DisplayNameValueInWindowsFlags = 0; sc.Subgraph[0].Name = "Subgraph name"; sc.Subgraph[0].DrawStyle = DRAWSTYLE_LINE; // inputs Input_Price.Name = "Price"; Input_Price.SetInputDataIndex(SC_HL_AVG); Input_Period.Name = "Period"; Input_Period.SetInt(10); Input_Period.SetIntLimits(1, MAX_STUDY_LENGTH); sc.AutoLoop = 1; sc.GraphRegion = 0; // Enter any additional configuration code here return; } // Perform your data processing here. SCString ValueText; SCFloatArrayRef Price = sc.BaseData[Input_Price.GetInputDataIndex()]; //int MaxValue = max(-5, 3); float Highest = sc.GetHighest(Price, Input_Period.GetInt()); float Lowest = sc.GetLowest(Price, Input_Period.GetInt()); float Range = Highest - Lowest; ValueText.Format("Highest: %4.0f\n",Highest); ValueText.Format("Lowest: %4.0f\n",Lowest); sc.AddAndManageSingleTextDrawingForStudy( sc, false, 1, 95 , Subgraph_TextDisplay , true , test2 , true ); return; } |
To post a message in this thread, you need to log in with your Sierra Chart account: