NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > Application Technical Support > Strategy Analyzer

Strategy Analyzer Support for automated system backtesting and optimization using the NinjaTrader Strategy Analyzer.

Reply
 
Thread Tools Display Modes
Old 08-02-2008, 02:52 PM   #1
bluelou
Senior Member
 
Join Date: Apr 2008
Posts: 512
Thanks: 6
Thanked 1 time in 1 post
Default Multi-timeframe strategy w/daily bars not running

Ninjas,
I've created a copy of the 'SampleMultiTimeFrame' Strategy with 1-minute bars as the primary timeframe and I've tried to add daily bars to this strategy without success.

--I'm testing on the ZN 09-08 contract. In the Log file , the strategy initializes but no trades occur. When I remove the daily timeframe several trades occur.
--The only change that I've made to the canned NT strategy is the following line, no other changes have been made:
In Initialize() I've added the following:
Add(PeriodType.Day, 1);
--The primary timeframe is 1 minute bars. The strategy will run when I add tick or minute timeframes, it's only the daily timeframe that is the problem.
--My data provider is IQFeed and I'm able to chart daily data for any given instrument.

Question:
1) Are there any known problems when trying to add a Daily timeframe to a strategy? With or without IQFeed?
2) Can you try to replicate this problem using a copy of the canned'SampleMultiTimeFrame' Strategy ?

Thanks,
Lou
bluelou is offline  
Reply With Quote
Old 08-02-2008, 06:35 PM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

There are no reports of anything wrong with adding a daily time frame. I have tested it on my end with the stock SampleMultiInstrument and I have no problems. Please check your Control Center logs for any errors. Also find attached my test sample.
Attached Files
File Type: zip SampleMultiTimeFrameDaily.zip (3.0 KB, 24 views)
NinjaTrader_Josh is offline  
Reply With Quote
Old 08-03-2008, 12:28 PM   #3
bluelou
Senior Member
 
Join Date: Apr 2008
Posts: 512
Thanks: 6
Thanked 1 time in 1 post
Default

Josh,
I was able to get the daily data to work using my version of the strategy. Apparently, the problem was that I was only using 8 days of daily data since that's all the tick data I had for the other timeframes. Once I increased the period to about 1+ months I was able to get the daily data to work properly.

Also, I have a related question but I think it realtes more to different data providers so I'll post it in the Miscellaneous section of the forum.

Thanks,
Lou
bluelou is offline  
Reply With Quote
Old 08-03-2008, 12:55 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

Great. Glad you got it sorted out.
NinjaTrader_Josh is offline  
Reply With Quote
Old 08-27-2008, 08:28 PM   #5
jonesr227
Junior Member
 
Join Date: Aug 2007
Posts: 21
Thanks: 0
Thanked 0 times in 0 posts
Default

Based on what is written previously in this thread, the following code should work. Specifically I'm using 1 minute data (only) and I'm trying to get the daily (2 day) moving average to print out its values. Nothing at all is output and there are no error messages in the log. (By the way, variable ma is declared as a double).

What do I need to do to get the daily time series from 1 minute?


Code:
protectedoverridevoid Initialize()
{
Add(PeriodType.Day, 1);
CalculateOnBarClose = true;
}
Code:
protectedoverridevoid OnBarUpdate()
{
if (BarsInProgress != 0)
return; 
 
ma = SMA(BarsArray[1], 2)[0];
Print(ma);
 
}
jonesr227 is offline  
Reply With Quote
Old 08-28-2008, 12:41 AM   #6
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

You just run it on a 1min chart and access BarsArray[0]. To output you need daily chart data. Please ensure you have data.
NinjaTrader_Josh is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Designing multi-instrument, multi-timeframe mikeyork Strategy Development 5 07-08-2008 08:47 PM
Bug: multi-timeframe strategy non-primary bar is off by one henry.omd Strategy Development 1 11-15-2007 12:37 AM
Multi timeframe strategy charts in strategy analyzer JonesWooHoo Strategy Development 10 10-31-2007 05:13 AM
backtesting a multi-timeframe strategy ceesvh Strategy Analyzer 1 09-18-2007 12:05 PM
Multi-Timeframe use in a Strategy Freddie Strategy Analyzer 25 05-30-2007 07:02 AM


All times are GMT -6. The time now is 03:43 AM.