Login Page - Create Account

Support Board


Date/Time: Sun, 16 Mar 2025 21:28:41 +0000



[Programming Help] - question on sc.UseTool() for DRAWING_HORIZONTALLINE

View Count: 565

[2022-08-25 22:51:00]
User275839 - Posts: 61
Hello -

I'm using sc.UseTool() to draw horizontal lines at price levels. I set tool.BeginValue to the price at which I want to draw the line. That works fine. The line is drawn at that price, and the price value appears as text above the line. (Right aligned because I specify DT_RIGHT.)

In my study, I want to optionally set a text label for the line instead of showing the price. By setting the tool.Text to the desired string, I can get the text label to display.

HOWEVER, in the case where I display a text label, I want to suppress the price from showing as well. Is there a way to suppress the price display, while still enabling display of a text label?

Thanks for any pointers. :)
[2022-08-26 04:02:53]
Tony - Posts: 554
It is probably easier to have a separate string and use sc.UseTool() to draw that string.


SCString LineRelatedInfo {""};
if (condition1)
LineRelatedInfo.Format("this happens");
else
LineRelatedInfo.Format(".2f", LinePrice);


for the horizontal location, a string can be drawn anywhere from index 0 to sc.Index+124
Date Time Of Last Edit: 2022-08-26 04:05:25
[2022-08-26 06:03:06]
User275839 - Posts: 61
Thank you for your suggestion. Later this evening I tried messing around with different combinations and found that this did what I wanted:

To show just the text (right aligned on top of line):

drawTool.DisplayHorizontalLineValue = 0;
drawTool.TextAlignment = DT_RIGHT | DT_TOP;
drawTool.Text = "SAMPLE TEXT";

To show just the price (right aligned and on top of line):

drawTool.DisplayHorizontalLineValue = 1;
drawTool.TextAlignment = DT_RIGHT | DT_TOP;
drawTool.Text = "";

So I think this approach will meet my needs for the time being.

Thank you again for checking my post and providing assistance!

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

Login

Login Page - Create Account