How to for loop multiple values from a loop?

  • Thread starter Thread starter Frankdot
  • Start date Start date
F

Frankdot

Guest
for (int barIndex = index; barIndex <= ChartBars.ToIndex; barIndex++)
{

if(cma < Bars.GetHigh(barIndex) && cma > Bars.GetLow(barIndex))
{
index0 = barIndex;

}
}


for (int barIndex = index; barIndex <= index0; barIndex++)
{

sumOfVolumes10 += Bars.GetVolume(barIndex);
Print(sumOfVolumes10);
}


Here's the situation index0 returns all the bars that are about equal to my cma. So you have bars 1020, 1050, 1070 for exemple.

index is a bar position for exemple 900. So i try to for loop all the numbers of bar between 900 and each values returned by my if statement.

900 ----> 1020

900 ----> 1050

900 ----> 1070

But sumOfVolumes10 += Bars.GetVolume(barIndex);
Print(sumOfVolumes10);

Only returned the total number for 900 to 1070 without returning 900 to 1020 and 900 to 1050.

How can i get those 2 missing?


Thank you

Continue reading...
 
Back
Top