I'm stuck on the logic of this simple strategy (which is related to conditions to satisfy for consecutive bars). I would like to measure the volume (I'm using Volumetric bars) of the last 2 bars just completed (not the bar that has yet to finish). If both bars meet the conditions then it should print a dot. While I have absolutely no problems with the single bar strategy, I can't get the 2 bar logic to work. Can you help me please?
This is the simple code for 1 bar strat (for long candles):
if (barsType.Volumes[CurrentBar].TotalVolume > volumeThreshold && Close[0] > Open[0]
{
Draw.Dot(this, "Bar"+CurrentBar, false, Time[0], Low[0]-TickSize*5, Brushes.Green);
}
This instead is the 2 consecutive bars logic that doesn't work:
if (barsType.Volumes[CurrentBar].TotalVolume > volumeThreshold && Close[0] > Open[0]) && (barsType.Volumes[CurrentBar - 1].TotalVolume > volumeThreshold && Close[1] > Open[1])
{
Draw.Dot(this, "Bar"+CurrentBar, false, Time[0], Low[0]-TickSize*5, Brushes.Green);
}
Comment