I try to create an increment to get the volume backward from cursorX.
for (int i = 0; i < 100; i++)
for(int barIndex = ChartBars.GetBarIdxByX(chartControl, cursorPointX) - i; barIndex <= ChartBars.GetBarIdxByX(chartControl, cursorPointX); barIndex++)
{
sumOfVolumes4 += Bars.GetVolume(barIndex);
}
Print(sumOfVolumes4);
i should be equal to 1,2,3 till 100 to the test the volume for every period. But its not returning what expected and i would like to know if there is a nt method to get the max number of bars till the beginning of the chart to prevent crashing. If there is 400 bars i would like to test the 400 bars and than put an if statement to text if the sum of volume = myvariable in volume.
ty
Comment