Hello,
I try to query for the index number of a previous bar, where certain conditions were met, i.e. a moving average was within a bars range.
I used a for loop as follows. But that does not work as intended:
Has someone an idea where I my code goes off the rails?
Thanks.
I try to query for the index number of a previous bar, where certain conditions were met, i.e. a moving average was within a bars range.
I used a for loop as follows. But that does not work as intended:
Inserted Code
int bars = iBars(NULL,PERIOD_H1); for(int i = 0; i >= bars - 1; i++) { if(MAH1.Main(i) >= iLow(NULL,PERIOD_H1,i) && MAH1.Main(i) <= iHigh(NULL,PERIOD_H1,i)) maTouched = true; if(maTouched == true) lastIndexDigit = i; break; }
Has someone an idea where I my code goes off the rails?
Thanks.