NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


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 05-13-2009, 09:18 AM   #1
pureporsche
Junior Member
 
Join Date: Jan 2009
Posts: 26
Thanks: 0
Thanked 0 times in 0 posts
Default Multi Time Frame strategy glitch.

Curious if some one can offer some info on this issue.

I have a multi time frame strategy on the same equity.

CalculateOnBarClose = true;

The primary [0] time frame is a 1 min and the second [1] is a 5 min.

I have a strategy running on the 5 min time frame. Let's call it "Y".
If Y is true --> Open a trade.
This strategy works fine and triggers trades on the correct bars.

I added a condition (lets call it "X") on the 1 min time frame.
The condition "X" simply states: if X is true, do Y.

As an example:
When running Y only (this is on the 5 min time frame), I get a trade trigger that, for instance, is initiated on the close of the 10:35am bar, which means the trade is executed on open of the following bar at 10:40am.
This is correct.

However when altering this strategy and adding:

if (BarsInProgress == 1)
If Y is true --> set someVariable = 1 (do not open a trade)

if (BarsInProgress == 0)
If X is true & someVariable == 1 --> open a trade.

What I'm noticing is that the Y trigger still takes place on the 10:35am bar.
However the trade is only executed on the open 1 min after, hence on the open of the 10:37am (1min time frame) bar.

Shouldn't this be triggered on the open of the 10:36am bar?
Why is there a 1 min lag?
pureporsche is offline  
Reply With Quote
Old 05-13-2009, 09:26 AM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Expected. At 10:35 you get the 5 minute signal. At 10:36 you check for condition x + y. It is evaluated to true, BUT since it was evaluated to true at the end of the 10:36 bar that bar is untradeable. Next tradeable location is the open of the 10:37 bar and that is where it is placed.
NinjaTrader_Josh is offline  
Reply With Quote
Old 05-13-2009, 09:35 AM   #3
pureporsche
Junior Member
 
Join Date: Jan 2009
Posts: 26
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks for the quick answer!

However all conditions are true on the close of the 10:35 bar. Shouldn't execution in this case happen on the open of the 10:36 bar.

So what you are saying, it's my understanding that in a multi time frame strategy, variables passed between different time frames require additional bars to execute?

So for instance if I were to add an additional condition "M" for instance, on another time frame it would require another 1 minute (1 min chart) before execution?
pureporsche is offline  
Reply With Quote
Old 05-13-2009, 09:59 AM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

No, you need to consider the order of events. 1 minute is your primary. You processed the 1 minute 10:35 before the 5 minute 10:35. Next call to 1 minute is 10:36.

If you want to get a signal from 5 minute and submit right away you should just use the overload method on your entry orders to place it to the correct BarsInProgress.

EnterLong(int barsInProgressIndex, int quantity, string signalName)


Roll all of your logic into 5 minute series. Use BarsArray[0] to check the 1minute for information instead of waiting for the next update to check. Then just send your order to BarsInProgress 0.
NinjaTrader_Josh is offline  
Reply With Quote
Old 05-13-2009, 10:05 AM   #5
pureporsche
Junior Member
 
Join Date: Jan 2009
Posts: 26
Thanks: 0
Thanked 0 times in 0 posts
Default

Perfect! Thanks Josh.
I was starting to think this had to do with the sequence of events.
Cheers!
pureporsche 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
Multi-time frame strategy - Longer-term real-time calculations Shansen Strategy Development 1 04-19-2009 06:36 AM
Market Reply and Multi time frame Strategy problem kekkis Strategy Development 3 12-30-2008 05:26 AM
Multi Time Frame/Multi Instrument? GreenTrade Strategy Development 3 01-14-2008 02:24 PM
Multi time frame syncronize chart with strategy ct Strategy Development 22 01-03-2008 12:22 PM
Accessing High value in a multi time frame strategy PrTester Strategy Development 4 05-02-2007 01:13 AM


All times are GMT -6. The time now is 08:05 PM.