Dear coders,
I want to loop back 20 bars. Is this correct ?
for(int i=0; i<Bars;i++)
{
some code...[i] but I m interested how much loop is going to interate
}
In this case it will loop on all Bars on chart. How can I loop only 20 bars back ? Thank you
This is what your loop should look like.
int bars = iBars(_Symbol, PERIOD_CURRENT); for (int i=0; i<bars && i<20; i++) { }
Thanks :)
Dear coders,
I want to loop back 20 bars. Is this correct ?
for(int i=0; i<Bars;i++)
{
some code...[i] but I m interested how much loop is going to interate
}
In this case it will loop on all Bars on chart. How can I loop only 20 bars back ? Thank you