Order failed to open. Error: 0 - page 3

 
af1:

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:

  • Adding RefreshRates: helps but the ea only tries one time to open the order. Then retry again at the next iteration. (I would like to retry immediately).
  • No calling GetLastError: helps to solve Error: 0. But now other errors appears (138, 4110, 4111).
  • While loop: I think this is the answer to open an order and retry until opens. I just don't know how to add correctly to the code.
Someone could help me to add this "while" function. I really appreciate it.


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.....

....

RaptorUK:

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.

 

af1:

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.

 
deVries:


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.....

....

Error 0 is solved when use RefreshRates(); however, frequently I get the error 138 (requote), so that's why Im trying to add a loop. I mean, all other functions of the ea works fine, opening orders is the only issue.
 
SDC:

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.

I know you did, but I don't know where to put it. And no, I'm not looking for any magic fix, I spent hours searching and trying to solve it before asking for help.
 
can some body explain fGetLots(OP_SELL) means
 
asalam814672: can some body explain fGetLots(OP_SELL) means
Function get lots. See the original post.
Reason: