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
Signal on EOD RTH and enter trade in ETH
Collapse
X
-
Hello RandyT,
Thanks for your question.
This would involve writing a multi series NinjaScript. Our Multi Time Frame and Instruments documentation provides a complete walk through for creating multi series NinjaScripts, and I would highly recommend referencing it as you develop this strategy.
For a rough demonstration on how this could be set up, please consider the following:
Code:private SMA mySMA; protected override void OnStateChange() { if (State == State.SetDefaults) { ... } else if (State == State.Configure) { AddDataSeries("AAPL", new BarsPeriod { BarsPeriodType = BarsPeriodType.Minute, Value = 1440 }, "US Equities RTH"); } else if (State == State.DataLoaded) { mySMA = SMA(BarsArray[1], 14); // Use BarsArray[1] to reference the first data series that is added by the NinjaScript } } protected override void OnBarUpdate() { if (BarsInProgress == 0) { // Calculate off the primary data series here if(Close[0] > mySMA[0]); // Checks if the last seen Close price for the Primary data series is greater than the last value of the SMA on the secondary series. EnterLong(); if(Time[0] > Times[1][0]) // Checks if the Timestamp of the current iterating bar is greater than the timestamp of the last bar on the secondary series. EnterLong(); } else if (BarsInProgress == 1) { // Calculate off the added data series here. } }
I'll include publicly available documentation on Multi Series NinjaScripts, and I will include a link to some example strategies that demonstrate time filters and entering on different time frames.
Multi Time Frame and Instruments (Important Read!) - https://ninjatrader.com/support/help...nstruments.htm
Using a Time Filter to limit trading hours - https://ninjatrader.com/support/help...to_limit_t.htm
Entering on a different time frame - https://ninjatrader.com/support/help..._frame_and.htm
Please let us know if you have any additional questions.Last edited by NinjaTrader_Jim; 07-25-2018, 08:27 AM.JimNinjaTrader Customer Service
-
Thanks Jim, that should get me well down the path.
Question regarding the AddDataSeries() call.
Code:AddDataSeries("AAPL", new BarsPeriod { BarsPeriodType = BarsPeriodType.Minute, Value = 1440 }, "US Equities RTH");
Comment
-
Hello RandyT,
Yes, you could use a continuous contract symbol if your data provider supports continuous contracts. You could also pass null as the instrument name and the primary data series will be used to define the instrument.
Please let us know if there is anything else we could do to help.JimNinjaTrader Customer Service
Comment
-
Hello RandyT,
Real-Time data is not provided from CQG/Continuum for Continuous Contracts. NinjaTrader 7 would synthetically create a Continuous Contract. This was left out as NinjaTrader 8 will offer the same behavior using the front month and the default Merge Policy of MergeBackAdjusted.
Substituting null for the Instrument Name will use the symbol of the primary data series for the Instrument Name. For example:
Code:AddDataSeries(null, new BarsPeriod { BarsPeriodType = BarsPeriodType.Minute, Value = 1440 }, "US Equities RTH");
Merge Policy - https://ninjatrader.com/support/help...rge_policy.htmJimNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by aligator, 01-06-2022, 12:14 PM
|
4 responses
233 views
0 likes
|
Last Post
by john_44573
Today, 06:11 PM
|
||
Started by reynoldsn, Today, 05:56 PM
|
0 responses
4 views
0 likes
|
Last Post
by reynoldsn
Today, 05:56 PM
|
||
Started by bortz, 11-06-2023, 08:04 AM
|
51 responses
1,989 views
0 likes
|
Last Post
by aligator
Today, 05:50 PM
|
||
Started by dmking, 11-12-2019, 12:31 PM
|
4 responses
4,150 views
0 likes
|
Last Post
by jasonw
Today, 04:32 PM
|
||
Started by roblogic, Today, 04:31 PM
|
0 responses
10 views
0 likes
|
Last Post
by roblogic
Today, 04:31 PM
|
Comment