Ok, at this moment I'm lost. I've been trying some changes in the code, but this is what I've seen so far:
Or in other words, let's forget all the errors. I just would like the ea open the order as fast as possible, if there is an error, then retry immediately at the next tick.
and for what reason was error 0 happening
if you don't fix your problems in a good way then you keep have problems
if you wanna retry, retry, retry with loop until opens without caring why it fails
then allright forget it ......
use your EA how it is, it doesn't matter .....
for what reason do you wanna know why it fails opening, closing, modify trades.....
If you really want to know the proper way to handle these errors . . . it tells you here: Trading errors for error 138 do this:
The requested price has become out of date or bid and ask prices have been mixed up. The data can be refreshed without any delay using theRefreshRates function and make a retry. If the error does not disappear, all attempts to trade must be stopped, the program logic must be changed.
Someone could help me to add this "while" function. I really appreciate it.
I did already.
Are you trying to learn how to code or are you just looking for people to give you a magic fix ? If you do not know about while look it up and learn about it, it is all in the documentation, if you did that already the code example I gave you would make sense to you.