The key is "try and try again".
Roughly like this:
while (tries < 3) { ticket = OrderSend(Symbol(),OP_SELLLIMIT,lotsize,openprice,Slippage,st,tp,"Order",magicnr,0,Red); if(ticket<=0) {//Order not accepted tries++; } else tries = 3; }
Is there a way to accept requotes in MQL4?
I have refreshrates() in my script but I still get requotes
Make sure your RefreshRates() call is as near as possible before your OrderSend(). You don't want to be doing a whole lot more time consuming processing in between.
And perhaps increase your slippage? :-)
Make sure your RefreshRates() call is as near as possible before your OrderSend(). You don't want to be doing a whole lot more time consuming processing in between.
And perhaps increase your slippage? :-)
Yes I forgot about that.
In addition, especially if you're scalping, check that prices are still acceptable before trying once more to force the order through...
On the first try you might have an indicated profit, but on the next try, or the try after that, the priced may have changed too much.
Also add a pause of about 3secs between each try otherwise you may get out of sync with the replies from the trade server.... this is
if you send the next try on the next tick.
If instead you fire from a loop as suggested above the pause is 'mandatory' otherwise you'll just be sending (3) simultaneous requests
which of course is nonsense.
Yes I forgot about that.
In addition, especially if you're scalping, check that prices are still acceptable before trying once more to force the order through...
On the first try you might have an indicated profit, but on the next try, or the try after that, the priced may have changed too much.
Also add a pause of about 3secs between each try otherwise you may get out of sync with the replies from the trade server.... this is
if you send the next try on the next tick.
If instead you fire from a loop as suggested above the pause is 'mandatory' otherwise you'll just be sending (3) simultaneous requests
which of course is nonsense.
How do you pause in MT4 code?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Is there a way to accept requotes in MQL4?
I have refreshrates() in my script but I still get requotes