How do I know which data series the draw object is drawn against?
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Draw objects from different series
Collapse
X
-
Draw objects from different series
Is there a way to draw a line on current chart based on bars from a different time frame, primarily how to handle bars ago?
How do I know which data series the draw object is drawn against?Last edited by shildebrand324; 02-07-2022, 09:12 PM.Tags: None
-
Hello shildebrand324,
Thanks for your post.
Please see the attached example script demonstrating how to draw a line on the primary data series and have that line calculated from a secondary added data series.
To accomplish this, you would add a secondary series to your script using AddDataSeries(). In OnBarUpdate() you would check if the primary series is processing by checking if BarsInProgress == 0. Then, you would call your Draw.Line() method and use values from the secondary price series, such as Closes[1][0].
Note that the drawing object will draw in the primary series if you call Draw.Line() in your BarsInProgress == 0 condition check.
See the help guide documentation below for more information.
PriceSeries<T>: https://ninjatrader.com/support/help...riceseries.htm
Closes: https://ninjatrader.com/support/help...nt8/closes.htm
Draw.Line: https://ninjatrader.com/support/help.../draw_line.htm
BarsInProgress: https://ninjatrader.com/support/help...inprogress.htm
AddDataSeries: https://ninjatrader.com/support/help...dataseries.htm
Let us know if we may assist further.Attached FilesLast edited by NinjaTrader_BrandonH; 02-08-2022, 10:04 AM.Brandon H.NinjaTrader Customer Service
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by mkouitra, 10-23-2021, 04:40 PM
|
17 responses
1,960 views
0 likes
|
Last Post Today, 12:51 AM | ||
Started by Vietanhnguyen2hotmailcom, 05-03-2024, 10:29 AM
|
4 responses
28 views
0 likes
|
Last Post Yesterday, 09:06 PM | ||
Started by PhillT, 04-19-2024, 02:16 PM
|
4 responses
36 views
0 likes
|
Last Post
by PhillT
Yesterday, 04:24 PM
|
||
Started by ageeholdings, 05-01-2024, 05:22 AM
|
5 responses
38 views
0 likes
|
Last Post
by ageeholdings
Yesterday, 03:21 PM
|
||
Started by reynoldsn, Yesterday, 02:34 PM
|
0 responses
16 views
0 likes
|
Last Post
by reynoldsn
Yesterday, 02:34 PM
|
Comment