MetaTrader 4 Error 136 – Off Quotes
I have been running this particular expert adviser on Oanda for some time and it’s been working great. Probably about a week ago, I began to get this error 136 off quotes error when it sent out the OrderSend command. I contacted Oanda support and posted the question on Oanda forum, but the only reply I got from Oanda was, “We haven’t heard from other customers complain about this problem. We do not provide programming support or advice. Please blah blah blah…”
How could one thing work for a long time and break all of a sudden? I asked Oanda if they changed something but no response was given. Looks like I had to figure it out on my own.
I Googled and Googled and the discussion was circling around timing of the order, delayed quotes, etc. So I changed the slippage to 5 pips in my script and also the default setting on MT4. None of them worked. The ‘off quotes’ error continued to happen.
So I decided to change each parameter in the OrderSend command to see which one was giving me the grief. Then I found it.
My original command looked as follows:
OrderSend(Symbol(),OP_SELLLIMIT,lots,mid,3,0,mid-tp*Point,”expert comment”,255,TimeCurrent()+(PERIOD_M1*60)*14,CLR_NONE);
Oanda originally accepted the expiration on MT4 at the minimum of 10 minutes if I remembered correctly. Mine was set at 14 minutes. See the formula highlighted in orange above.
Somehow they decided to synch up with the FxTrader Java platform on which the minimum of order expiration was 1 hour.
After I changed the command to
OrderSend(Symbol(),OP_SELLLIMIT,lots,mid,3,0,mid-tp*Point,”expert comment”,255,TimeCurrent()+(PERIOD_M1*60)*60,CLR_NONE);
The expert adviser now works. However, I don’t want to leave my order out there for an hour. So I have to write some code to delete the unfilled order after 14 minutes as I had originally programmed.
