cunparis
03-11-2009, 11:27 AM
I'm working on a strategy with two timeframes and I'd like to use the results of the 60m timeframe to decide on an entry on say 15m timeframe. I have 15m as my primary bar and 60m as my secondary bar. The problem I see is that my primary bar will complete first and then the secondary bar. So we see:
19:00 15m
19:00 60m
19:15 15m
19:30 15m
19:45 15m
20:00 15m
20:00 60m
20:15 15m
So let's say my 60m bar at 20:00 gives me a setup and now I want to check the 15m bar. The problem is I must wait until 20:15 to be able to check the 15m bar and enter.
So I was thinking about using CalculateOnBarClose = false but then it'd process the tick data and I only want to use the data from the 60m close.
The only solution I can see is to filter out the tick data until say 1 minute before the 60m will close and then when the 15m bar closes I'll have the results of the 60m (1 minute early) and then I can process my 15m and enter if I want.
Does this sound like the right way to accomplish this? Do I just do something like this:
if(BarsInProgress == 1) {
if(Time[0].Minute==59) {
// make my decision on 60m bar
} else {
// skip this tick data
return;
}
}
The only problem I see is how to backtest this. I'm not sure it's possible. The other possibility which I just thought of and just tested is to run my strategy on 15m bar and in initialize I add 60m bar and another 15m bar and ignore the first 15m.
Add(PeriodType.Minute, 60);
Add(PeriodType.Minute, 15);
This seems like it will work. Any disadvantages to this approach?
Thanks
19:00 15m
19:00 60m
19:15 15m
19:30 15m
19:45 15m
20:00 15m
20:00 60m
20:15 15m
So let's say my 60m bar at 20:00 gives me a setup and now I want to check the 15m bar. The problem is I must wait until 20:15 to be able to check the 15m bar and enter.
So I was thinking about using CalculateOnBarClose = false but then it'd process the tick data and I only want to use the data from the 60m close.
The only solution I can see is to filter out the tick data until say 1 minute before the 60m will close and then when the 15m bar closes I'll have the results of the 60m (1 minute early) and then I can process my 15m and enter if I want.
Does this sound like the right way to accomplish this? Do I just do something like this:
if(BarsInProgress == 1) {
if(Time[0].Minute==59) {
// make my decision on 60m bar
} else {
// skip this tick data
return;
}
}
The only problem I see is how to backtest this. I'm not sure it's possible. The other possibility which I just thought of and just tested is to run my strategy on 15m bar and in initialize I add 60m bar and another 15m bar and ignore the first 15m.
Add(PeriodType.Minute, 60);
Add(PeriodType.Minute, 15);
This seems like it will work. Any disadvantages to this approach?
Thanks