Announcement
Collapse
No announcement yet.
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:
A 1440 minute data series is added with the RTH trading hours template. We will need to add our daily RTH series this way because regular daily bars will be in ETH format. Calculations for the daily RTH series would be done in BarsInProgress 1 since this is the first data series added by the script. BarsInProgress 0 will be used for calculations on the primary data series that the script is applied to. TimeSeries and PriceSeries objects can be referenced for data series other than the current data series that is iterating by using the plural reference. I.E. Times[1][0] for the secondary data series.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.
-
Thanks Jim, that should get me well down the path.
Question regarding the AddDataSeries() call.
I'm dealing with Futures contracts in this strategy. Is there another way to do this without the reference to the symbol name since that will change for me? Or a way to refer to a continuous contract? I'm not seeing a way to refer to the Timeframe string without also including a symbol name.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.
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:
Continuous Contracts are noted as ES ##-##. I've also included information on NinjaTrader's merge policies for further reading.Code:AddDataSeries(null, new BarsPeriod { BarsPeriodType = BarsPeriodType.Minute, Value = 1440 }, "US Equities RTH");
Merge Policy - https://ninjatrader.com/support/help...rge_policy.htm
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, 03-13-2026, 05:17 AM
|
0 responses
86 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
151 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
79 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
52 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
59 views
0 likes
|
Last Post
|

Comment