Login Page - Create Account

Support Board


Date/Time: Fri, 07 Mar 2025 01:07:03 +0000



[Programming Help] - Drawing Once per bar

View Count: 533

[2022-02-19 00:00:55]
Csurles2010 - Posts: 13
Hello everyone,

I am looking for a way to draw text underneath each bar. I can draw the text under each box fine using the code below. However, it will update several times on the last bar, and each bar after that is loaded in real time. I want to adjust the text as it's updated, but only once per bar. It draws the text on closed bars and updates only once. Is it possible to draw on closed bars and real time bars only once?

Thanks



int Index = sc.Index;
int& r_LineNumberText = sc.GetPersistentInt(1);
SCString value;
s_UseTool ToolText;

if (r_LineNumberText != 0)
  ToolText.LineNumber = r_LineNumberText;

ToolText.ChartNumber = sc.ChartNumber;
ToolText.DrawingType = DRAWING_TEXT;
ToolText.AddMethod = UTAM_ADD_ALWAYS;

ToolText.UseRelativeVerticalValues = true;
ToolText.MultiLineLabel = 1;

ToolText.BeginIndex = Index;
ToolText.BeginValue = 10;

ToolText.Color = RGB(0, 255, 255);
ToolText.Text = value.Format("%i \n%.2f \n%.2f \n%.2f", Index, sc.High, sc.Low, sc.Open);
ToolText.TextAlignment = DT_VCENTER;
ToolText.FontSize = 0;

sc.UseTool(ToolText);
r_LineNumberText = ToolText.LineNumber;


To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account