I'm trying to compare values from different time frame under one if condition. How do I set BarsInProgress properly, in order for this to work?
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
}
else if (State == State.Configure)
{
AddDataSeries(Data.BarsPeriodType.Minute, 5);
AddDataSeries(Data.BarsPeriodType.Minute, 30);
}
else if (State == State.DataLoaded)
{
EMA30min21 = EMA(Closes[2], 21);
EMA30min60 = EMA(Closes[2], 60);
EMA5min60 = EMA(Closes[1], 60);
EMA5min100 = EMA(Closes[1], 100);
}
protected override void OnBarUpdate()
{
// how to set BarsInProgress for below if condition to work?
[COLOR=#FF0000] if (BarsInProgress != 0)
return;[/COLOR]
if (CurrentBars[0] < BarsRequiredToTrade || CurrentBars[1] < (BarsRequiredToTrade / 5f) || CurrentBars[2] < (BarsRequiredToTrade / 30f))
return;
[COLOR=#FF0000]if ((EMA5min60[0] > EMA30min21[0]
&& (EMA5min100[0] > EMA30min60[0])[/COLOR]
........
}

Comment