Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
SP500 Daily 200 MA and a Futures Tick-based Strategy
Collapse
X
-
You need 20 bars of data from all input series before your strategy will start running. Any indicator you run will run when the strategy starts. This is easy for you to confirm simply by running a strategy that just prints from OnBarUpdate() notifying you as to which BarsInProgress is triggering. You will find the daily will just keep triggering when higher granularity time frames are missing.
-
I'd love to load more tick data, I have many years worth. However, for some contracts I cannot even load a full contract at once in a strategy because they are very large and once NinjaTrader reaches about 1.3 GB of memory usage (as per the Windows Task Manager), I get 'out of memory' errors which requires shutting down NinjaTrader. I deal with that issue by back-testing one month at a time.
I would think there should be a way for secondary data used in strategies for other instruments or timeframes to be specified independently of the back-tester input parameters. There are times when the lookback periods required by an indicator is a significant magnitude in scale different than the time period desired for a back-test. It would be great if when adding a secondary data series if either the Start Date or the number of bars could be specified for the new data series. For example:
Add("^SP500", PeriodType.Day, 1, 300);
would create a secondary data series that had 300 bars of daily data available to it for calculation of indicators. Each data series is already managed separately via BarsInProgress and the BarsArray[], so I would imagine this might not be a difficult enhancement. But then again, I can only guess at the underlying complexity of managing multiple instruments and timeframes.
Regards,
David
dbw451
Leave a comment:
-
SP500 Daily 200 MA and a Futures Tick-based Strategy
I would like to add an SP500 cash index 200 day MA to an e-mini futures based strategy. My strategy is Tick based. I have 50+ years of historical SP500 cash index daily data. The tick data is in 3 month contracts (i.e. I am not using a continuous contract).
I am able to display a 200 day MA on a daily SP500 chart without any problems. In my strategy however, the values calculated for the 200 day MA using the SMA indicator are not correct. They are often 10+ points different than the 200 day SMA values on the daily chart.
I'm suspecting that since 200 days is a much longer lookback period than the days available in each individual historical futures contract, the SMA indicator might not be able to calculate the 200 day moving average correctly. If I use a smaller daily period MA (e.g. 10 days), the SMA indicator calculates the daily MA values properly.
There's nothing special about my strategy's implementation of the 200 day MA. I add the daily SP500 cash index in the Initialize() procedure:
protected override void Initialize()
{
Add("^SP500", PeriodType.Day, 1);
CalculateOnBarClose = true;
.....
}
And I calculate the 200 day MA when BarsInProgress == 1 in the OnBarUpdate() procedure:
protected override void OnBarUpdate()
{
if (BarsInProgress == 1)
{
daySMA200 = SMA(Close,200)[0];
....
}
}
Is there a way I can calculate a 200 day MA correctly in a multi-instrument and multi-timeframe strategy that uses 1 futures contract (i.e. 3 months) or less of tick data at a time?
Thanks,
David
dbw451Last edited by dbw451; 01-05-2009, 10:05 AM.Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by herzogvladimir2, Today, 08:10 PM
|
0 responses
2 views
0 likes
|
Last Post
![]() |
||
Started by giogio1, 04-13-2025, 01:42 AM
|
2 responses
31 views
0 likes
|
Last Post
![]()
by giogio1
Today, 07:19 PM
|
||
Started by mmenigma, 01-23-2024, 09:37 AM
|
1 response
86 views
0 likes
|
Last Post
![]()
by Nin8aTrender
Today, 03:47 PM
|
||
Started by wbayne333, 02-22-2021, 01:18 PM
|
6 responses
409 views
0 likes
|
Last Post
![]()
by Nin8aTrender
Today, 03:44 PM
|
||
Started by gtheaded, 07-03-2020, 03:47 PM
|
3 responses
370 views
0 likes
|
Last Post
![]()
by Nin8aTrender
Today, 03:21 PM
|
Leave a comment: