Login Page - Create Account

Support Board


Date/Time: Thu, 13 Feb 2025 07:45:32 +0000



[User Discussion] - ACSIL: Draw Horizontal Line on Study

View Count: 2842

[2020-11-24 08:02:34]
ycomp - Posts: 321
how could I code my indicator to draw a horizontal line at a specific value.. e.g. horizontal line at 0 - in my study?
[2020-11-24 09:40:58]
User907968 - Posts: 826
1) Draw a line at 0 using Drawing Tools - Using Drawing Tools From an Advanced Custom Study (for example scsf_UseToolExampleDrawingHorizontalLine in /ACS_Source/studies.cpp)

or

2) Use a subgraph to draw the zero line (make sure to enable 'Draw Zeros' - ACSIL Interface Members - sc.Subgraph Array: sc.Subgraph[].DrawZeros) and use drawstyle 'DRAWSTYLE_LINE_FROM_END_OF_CHART_LEFT_TO_RIGHT' (for example scsf_BidAskVolumeRatio in /ACS_Source/studies6.cpp)
[2020-11-24 09:44:54]
ycomp - Posts: 321
thanks, any idea on a good way to assign a unique # to the drwaing so that it would be safe to use multiple instances of the study on a chart? (I mean so that they have different drawing numbers)
[2020-11-24 10:19:13]
User907968 - Posts: 826
Left Sierra Chart define the drawing number (Using Drawing Tools From an Advanced Custom Study: s_UseTool::LineNumber) and then save it to a persistent variable for re-use as required.
[2020-11-24 10:30:13]
ycomp - Posts: 321
ah thanks i didn't realize it would be automatically assigned
[2020-11-24 11:06:36]
ycomp - Posts: 321
I can't get it to work - automatic definition and persistent storage technique.. I think it has something to do with AddAsUserDrawnDrawing being set. The LineNumber keeps decrementing even though I retrieve it from persistent storage and if it is not 0 then I assign it as the LineNumber of the Drawing.

I need to have AddAsUserDrawnDrawing set. But I also want to be able to use the automatic line number.

but because it keeps decrementing I keep creating many copies of the drawing, all with slightly different (decremented) line numbers.

any ideas?
[2020-11-24 12:03:29]
User907968 - Posts: 826
Thoroughly read the following information
Using Drawing Tools From an Advanced Custom Study: Preventing More Than One Chart Drawing Per Chart Bar or More Drawings than Intended
Using Drawing Tools From an Advanced Custom Study: Adjusting Existing Chart Drawings
Using Drawing Tools From an Advanced Custom Study: s_UseTool::AddMethod
[2020-11-25 15:47:56]
ycomp - Posts: 321
great, I fixed the problem - it was that I wasn't using the UTAM_ADD_OR_ADJUST and also I had to read the line number after the call to UseTool

would you know what property of the drawing I should set so that the drawing (in this case horizontal line) will always be displayed on the chart region? for example if the line is at 3 but the subgraphs data maxes out at 2 then the line won't be visible, when any of the subgraphs go to over 3 then the line will be visible again. In general I would like an automatic scale, but for the line to affect the scale.

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

Login

Login Page - Create Account