Hello all.
Sorry That this is split but i was getting an error that text is too long.
The above function is part of an EA that trades S/R levels. I am having problems witht he first for loop which is cycling between 200- 210 istead of between BarsPassed and 1. If anyone can help me find the reason i would be most thankfull
Thanks.
Tal
Hello all.
Sorry That this is split but i was getting an error that text is too long.
The above function is part of an EA that trades S/R levels. I am having problems witht he first for loop which is cycling between 200- 210 istead of between BarsPassed and 1. If anyone can help me find the reason i would be most thankfull
Thanks.
Tal
From the first look I see this:
for (i =BarsPassed ; i>=1; i--)
On the first loop BarsPassed=Bars and later you are trying to compare High[i] to High[i+1] which is the same as High[Bars+1]. This may cause some problems as there is no such value.
So it's better using BarsPassed=Bars-1;
From the first look I see this:
On the first loop BarsPassed=Bars and later you are trying to compare High[i] to High[i+1] which is the same as High[Bars+1]. This may cause some problems as there is no such value.
So it's better using BarsPassed=Bars-1;
Good point. Thanks for that.
Still doesnt solve the wierd behaviour of the loop though.
Thanks
Tal
Good point. Thanks for that.
Still doesnt solve the wierd behaviour of the loop though.
Thanks
Tal
Another thing is that you have to put break after every case. Not sure if it has anything to do with the for loop but without breaks this will be always the case -> Tolerance = 144;
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use