Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
draw in multi timeframe
Collapse
X
-
draw in multi timeframe
Hello, I have a multi-time frame indicator that draws lines and plots on a chart with a higher time frame and I want it to paint them on a chart with a lower time frame. it does, and the plots work perfectly but on the lines it does the direct transfer, that is, if the distance of the line in range 20 is 10 bars, in range 4 it also occupies only 10 bars. how could i solve it? Thank youTags: None
-
Hello Siolver,
Thanks for your post.
If you call Draw.Line() with the 'startBarsAgo' property set to 10 and the 'endBarsAgo' property to 0, the line drawing will be drawn from 10 bars ago to the current bar.
To change where the line drawing will start, you would need to modify the startBarsAgo property when calling your Draw method.
For example, if you want to draw the line from 5 bars ago to the current bar, you would pass in a 5 for the 'startBarsAgo' property and pass in a 0 for the 'endBarsAgo' property.
See this help guide page for more information and sample code: https://ninjatrader.com/support/help.../draw_line.htm
Let me know if I may assist further.<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
-
Hello Brandon,
Thanks for your quick response, but I think I didn't explain myself well.
the indicator draws in range 20 a line between two pivots. in range 5 high low are correct but not the number of bars. use the same number of bars in range 5 as use in range 20.
I attached an image to see better
Thank you!
Comment
-
Hello Siolver,
Thanks for the clarification.
How are your Draw.Line() methods being called in your script?
Something you could consider is when you detect the Low price you could save the CurrentBar to a variable named LowPriceBar. Then, you could subtract CurrentBar from that LowPriceBar variable to get the number of bars that have passed since the Low price and save that number to another variable named like BarsElapsed. You could then use that BarsElaped variable for your 'startBarsAgo' parameter so that the line is drawn at the bar the Low price was detected.
For example, say there are 100 bars on the chart. The Low price was detected on bar 80 and that bar was saved to a variable. You could subtract the CurrentBar (100) from the bar saved to the variable (80), to get the number of bars that have elapsed since the Low price (100 - 80 = 20 bars elapsed). That calculation could then be used for your 'startBarsAgo' argument when calling your Draw.Line() method.
Let me know if I may assist further.<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
672 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
379 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
111 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
575 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
582 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment