do you have a sleep within you loop?
Yes, Sleep (750)
Due to the fact that you haven't post your code I have to assume the problem is in your code.
Jusyer: while loop (while (IsTradeAllowed () == false)) but only makes three attempts, after exit the loop. | I can think of only two ways this could happen:
|
while (IsTradeAllowed()==false) { RefreshRates(); ticket=OrderSend(Symbol(),OP_SELL,auxImporte,Bid,3,0,0,"BO exp:60",magic); Sleep(750); }It's EA, no indicator.
Play videoPlease edit your post.
For large amounts of code, attach it.
- Your code says: if trading is not allowed, try to open an order. Makes no sense. If trading is not allowed, you should be sleeping. Then once it is allowed, you need to check if the trade still makes sense.
- You need RefreshRates() after sleeping.
- Check your return codes (OrderSelect) What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
Sorry for my short explanation, but my English is not very good.
The EA works correctly in 8 pairs, the problem exists when an order sent several pairs at once. When the order (1) can not be sent, then the EA enters this loop, then try again to launch the order (2), if it can send the order, the EA out of the loop, if it can not, try again, but this time if it can not send the order (3), the EA out of the loop.
Therefore, do not understand why the third time EA exits the loop.
... ticket=OrderSend(Symbol(),OP_SELL,auxImporte,Bid,3,0,0,"BO exp:60",magic); while (IsTradeAllowed()==false) { Sleep(750); RefreshRates(); ticket=OrderSend(Symbol(),OP_SELL,auxImporte,Bid,3,0,0,"BO exp:60",magic); } ...
Any ideas?
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi.
I'm using IsTradeAllowed () in a while loop (while (IsTradeAllowed () == false)) but only makes three attempts, after exit the loop. I would like not to go out of the loop until the order is placed. Can anyone help?
Thanks.