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 | ||
---|---|---|---|---|
Change colour of Stop market and limit orders to red and green via indicator script
by Rapine Heihei
Started by Rapine Heihei, 04-23-2024, 07:51 PM
|
2 responses
30 views
0 likes
|
Last Post
by Max238
Today, 02:25 AM
|
||
Started by Shansen, 08-30-2019, 10:18 PM
|
24 responses
943 views
0 likes
|
Last Post
by spwizard
Today, 01:29 AM
|
||
Started by Max238, Today, 01:28 AM
|
0 responses
9 views
0 likes
|
Last Post
by Max238
Today, 01:28 AM
|
||
Started by rocketman7, Today, 01:00 AM
|
0 responses
7 views
0 likes
|
Last Post
by rocketman7
Today, 01:00 AM
|
||
Started by wzgy0920, 04-20-2024, 06:09 PM
|
2 responses
28 views
0 likes
|
Last Post
by wzgy0920
Yesterday, 10:43 PM
|
Comment