Login Page - Create Account

Support Board


Date/Time: Thu, 02 May 2024 16:40:41 +0000



[Programming Help] - Drawing numbers above bars after condition is meet

View Count: 604

[2020-05-28 21:50:39]
User918738 - Posts: 31
Hi,

I have a study that after a certain condition is meet with the current bar, draws a number "1" over the high 8 bars back. The software places the number "1" 8 bars back but the height is based on the current bar's high and not the high of the bar displaced 8 bars in the past. Is it possible to match the "1" to that bar's height after the condition is meet in the current bar. image attached should have the "1" closure to the bar's high from 20:30:00, not the same height as the "9" at 00:30:00. the study draws "1" 8 bars back once the current bar is a 9.

Thanks in advance
imagetext alignment.PNG / V - Attached On 2020-05-28 21:43:06 UTC - Size: 3.77 KB - 191 views
[2020-05-29 04:47:07]
Flipper - Posts: 65
Have you got the code for the study?

Its pretty easy to place the drawn number where ever you want. In the code it probably has someing like this,


SubGraph_Name.Arrays[0][sc.Index - 8 ] = sc.High[sc.Index] + (4 * sc.TickSize)

Change it to


SubGraph_Name.Arrays[0][sc.Index -8] = sc.High[sc.Index-8] + (4 * sc.TickSize)

Noting this bit sc.High[sc.Index-8]
[2020-05-29 19:50:37]
User918738 - Posts: 31
No, i don't have the code for the study yet? I am creating it using the spreadsheet first then plan on learning how to code in SC and hopefully move it from spreadsheet into code.

Is possible to do that with only the study subgraph above/below bar with text?

Thanks for the help.
[2020-05-29 22:17:17]
Ackin - Posts: 1865
study subgraph above/below bar with text?
No

The study you mention only works with the current bar, it can't go back in time and rewrite the result on the Current-8 bars.

If you just want a "graphic idea" of what it will look like, you can use it but only on a static chart without movement (non replay, disconnected from the datafeed). Then you will see fine ....

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

Login

Login Page - Create Account