I am trying to build a multi-TimeFrames strategy : the 3 timeframes I work on are :
- 1 minute,
- 5 minutes
- 1 day
The code here below pretend to allow the orders to be taken only if the actual 1 minute bar bid is < first 5 minutes bar higher price of the present market session (Day) * a variabble (5 in this sample) :
protected override void Initialize()
{
Add(PeriodType.Minute,1);
Add(PeriodType.Minute,5);
Add(PeriodType.Day,1);
}
protected override void OnBarUpdate()
{
if(BarsInProgress!=0){return;}
if(GetCurrentBid(0)>Highs[1][Bars.BarsSinceSession]*5)
{
Entershort();
}
else
{
return;
}
}
Can anybody tell me if this code is correct ?
Thanks a lot in advance.
Comment