Brooks
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
Crossover of 2 instruments?
Collapse
X
-
Crossover of 2 instruments?
If you are charting 2 instruments, what Ninja Script would you use to test for the price of one crossing the price of the other?
BrooksTags: None
-
Thanks Ryan.
Will this still work if one issue trades in the 100 range and the other trades in the 500 range?
On the chart they may cross because one has Scale Justification set to Right and one to Left.
Will this work in an indicator to plot an object (dot, cross, etc.) as well as in a strategy as a basis to enter a trade?
If you did this in a backtest, where/how would you specify the 2nd instrument?
Brooks
Comment
-
Actually, I think I see that you can have a 2nd instrument in the same way that you can have a 2nd time series on the same instrument - using the Add statement.
Is it possible in Script to say that you want the 2nd instrument to have a Scale Justification = Left?
Comment
-
No, this will not work if your instruments do not trade in similar ranges.
You can adjust the scaling and you may see visual crosses, but these are not actual crosses and will never be interpreted as such by NinjScript. For crossing to return true, the values must cross.
For Version 7 only: You can set scale programatically through ScaleJustification property. This will apply to all plots within the indicator. It's not possible to have different scales on individual plots within the indicator.
Yes, adding instruments works similar to adding multiple time frames. See the multi-instrument sample for help on adding series to a strategy. Click Tools > Edit NinjaScript > Strategy > SampleMultiInstrument.
This help guide article can also help with this.Ryan M.NinjaTrader Customer Service
Comment
-
I'm using NT7. Would your original plot be separate from the one you add in the indicator? IOW, the original plot has a right scale. If you Add a plot in script and set its scale to left, you'd then have different scales, right?
If that's true, could you then compare a crossover?
You addressed indicators, how does this work for strategies?
"For Version 7 only: You can set scale programatically through ScaleJustification property. This will apply to all plots within the indicator. It's not possible to have different scales on individual plots within the indicator. "
Comment
-
Scale justifications are set per indicator, not a specific series. If you set the scale justification programatically then it will apply to all plots within the indicator.
Cross conditions will always test for value crossings. You can't configure to test for visual crossing seen with different scales.
When using strategies, cross conditions will still only test for values crossing. ScaleJustification property is only available with indicators.Ryan M.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by love2code2trade, Yesterday, 01:45 PM
|
4 responses
28 views
0 likes
|
Last Post Today, 10:31 PM | ||
Started by funk10101, Today, 09:43 PM
|
0 responses
7 views
0 likes
|
Last Post
by funk10101
Today, 09:43 PM
|
||
Started by pkefal, 04-11-2024, 07:39 AM
|
11 responses
37 views
0 likes
|
Last Post
by jeronymite
Today, 09:37 PM
|
||
Started by bill2023, Yesterday, 08:51 AM
|
8 responses
44 views
0 likes
|
Last Post
by bill2023
Today, 09:27 PM
|
||
Started by yertle, Today, 08:38 AM
|
6 responses
26 views
0 likes
|
Last Post
by ryjoga
Today, 09:17 PM
|
Comment