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
drawing a vertial line the price assigned to a double
Collapse
X
-
drawing a vertial line the price assigned to a double
Is it possible to draw a vertical line from the current bar to the price assigned to a double from another time frame using an indicator/strategy? If so, can you provide the syntax for this. I did not see it when I reviewed the support guide.Tags: None
-
Hello gordongekko,
Thanks for opening the thread.
It is possible to draw a line to any price level. The question would be how you plan on getting the data from another time frame. You could add an additional data series to get the price values from another instrument, and use those price values to dictate the price level your line's endpoints should be. This would be the supported way of accessing data from another time frame in a NinjaScript.
Code:Draw.Line(this, "tag1", false, 0, [B]Closes[0][0][/B], 0, [B]Closes[1][0][/B], Brushes.LimeGreen, DashStyleHelper.Dot, 2);
Multi Series NinjaScripts (Important read!) - https://ninjatrader.com/support/help...nstruments.htm
Please elt me know if you have any questions.JimNinjaTrader Customer Service
-
Hi Jim,
Thanks for the reply, When I use that syntax and plug in a double containing the closing price of a bar from a higher time frame I'm not seeing it on the chart.
Draw.Line(this, "tag1", false, 0, Closes[0][0], 0, htfhigh, Brushes.LimeGreen, DashStyleHelper.Dot, 2);
htfhigh is a double that contains a closing price from a bar obtained via a method using barsinprogress == 1 in the past that is far enough back to where the data is accessible from the primary data series so I'm not sure why its it not showing up on the chart.
Comment
-
Hello gordongekko,
I can offer some advise to help you debug this. We should start by asking the following questions:
- When testing, were you able to see the Draw.Line() appear when using Closes[0][0] and Closes[1][0]? How about when using numbers as input?
- Are you able to see the line when you have the auto scale parameter set to true?
- Lastly, there could another issue where the NinjaScript errors out and no longer performs any action. Do you see any errors in the log tab of the Control Center?
Adding prints for Closes[0][0] and htfhigh above the Draw.Line() can tell you:- if the Draw.Line() is reached
- if the input going into the Draw.Line() is valid and what you should expect visually
Please also note that DashStyleHelper.Dot would create a dotted line. DashStyleHelper.Line would create a solid line. I've included documentation links for Draw.Line() for reference as well as debugging tips that we have on our forums.
Draw.Line() - https://ninjatrader.com/support/help.../draw_line.htm
Debugging - https://ninjatrader.com/support/foru...ead.php?t=3418
Making sure you have enough bars (See "Accessing Price data in a Multi Series NinjaScript" for MultiSeries application) - https://ninjatrader.com/support/foru...ead.php?t=3170
Accessing Price data in a Multi Series NinjaScript - https://ninjatrader.com/support/help...arsninjascript
Please let us know if you need further assistance.JimNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by f.saeidi, Today, 11:02 AM
|
1 response
1 view
0 likes
|
Last Post Today, 11:08 AM | ||
Started by geotrades1, Today, 10:02 AM
|
4 responses
12 views
0 likes
|
Last Post
by geotrades1
Today, 11:08 AM
|
||
Started by rajendrasubedi2023, Today, 09:50 AM
|
3 responses
16 views
0 likes
|
Last Post Today, 10:57 AM | ||
Started by lorem, Today, 09:18 AM
|
2 responses
11 views
0 likes
|
Last Post Today, 10:55 AM | ||
Started by geddyisodin, Today, 05:20 AM
|
4 responses
30 views
0 likes
|
Last Post
by geddyisodin
Today, 10:45 AM
|
Comment