Topic: Please help with Off Quotes error
Hey there,
I've created a portfolio EA in EA Studio which I tested on an MT4 account but some trades are not being opened due to an "off quotes" error — see below log file. This is annoying because it does not perform how I want and it might make more losing trades and less winning trades. Therefore I lose money when I could be making money with what should be a good EA.
How do I fix this error?
Can I do it in my EA code? Could I change the slippage number "10" to something like "30" in the OrderSend function? My broker has 5 digits for the EURUSD symbol.
Or do I need to try more times to place my orders like changing a function that controls 'order retries' or something? I'm pretty sure I have a good internet connection, it's ultra fast fibre.
// Send an entry order with SL and TP
ticket = OrderSend(_Symbol, command, amount, price, 10, stopLoss, takeProfit, comment, magicNum, 0, arrowColor);
lastError = GetLastError();
// If order fails, check if it is because inability to set SL or TP
if (ticket <= 0 && lastError == 130)
{
// Send an entry order without SL and TP
ticket = OrderSend(_Symbol, command, amount, price, 10, 0, 0, comment, magicNum, 0, arrowColor);
19:50:29.281 '24597377': ping to current access point Datacenter is 290.77 ms
0 20:13:51.131 '24597377': order #1917027 buy 0.01 USDCAD at 1.25192 closed due stop-loss at price 1.24979
0 20:30:11.348 '24597377': order sell market 0.01 EURUSD sl: 0.00000 tp: 0.00000
0 20:30:11.368 '24597377': order sell market 0.01 EURUSD sl: 0.00000 tp: 0.00000
0 20:30:11.489 '24597377': order sell market 0.01 EURUSD sl: 0.00000 tp: 0.00000
0 20:30:11.891 '24597377': order was opened : #1917413 sell 0.01 EURUSD at 1.11561 sl: 0.00000 tp: 0.00000
1 20:30:11.891 '24597377': order sell 0.01 EURUSD opening at market sl: 0.00000 tp: 0.00000 failed [Off quotes]
1 20:30:12.240 '24597377': order sell 0.01 EURUSD opening at market sl: 0.00000 tp: 0.00000 failed [Off quotes]
0 20:30:12.240 '24597377': order sell market 0.01 EURUSD sl: 0.00000 tp: 0.00000
0 20:30:12.744 '24597377': order was opened : #1917414 sell 0.01 EURUSD at 1.11564 sl: 0.00000 tp: 0.00000
0 21:00:11.188 '24597377': order buy market 0.01 EURUSD sl: 0.00000 tp: 0.00000
0 21:00:11.335 '24597377': order buy market 0.01 EURUSD sl: 0.00000 tp: 0.00000
0 21:00:11.625 '24597377': order was opened : #1917488 buy 0.01 EURUSD at 1.11513 sl: 0.00000 tp: 0.00000
1 21:00:12.028 '24597377': order buy 0.01 EURUSD opening at market sl: 0.00000 tp: 0.00000 failed [Off quotes]
0 21:15:11.399 '24597377': order buy market 0.01 EURUSD sl: 0.00000 tp: 0.00000
0 21:15:11.414 '24597377': order sell market 0.01 EURUSD sl: 1.30542 tp: 0.00000
0 21:15:11.485 '24597377': order buy market 0.01 EURUSD sl: 0.00000 tp: 0.00000
0 21:15:11.977 '24597377': order was opened : #1917542 buy 0.01 EURUSD at 1.11382 sl: 0.00000 tp: 0.00000
1 21:15:11.977 '24597377': order sell 0.01 EURUSD opening at market sl: 1.30542 tp: 0.00000 failed [Off quotes]
1 21:15:11.977 '24597377': order buy 0.01 EURUSD opening at market sl: 0.00000 tp: 0.00000 failed [Off quotes]
0 21:15:11.977 '24597377': order sell market 0.01 EURUSD sl: 1.30543 tp: 0.00000
0 21:15:12.420 '24597377': order was opened : #1917543 sell 0.01 EURUSD at 1.11375 sl: 1.30543 tp: 0.00000
0 21:30:11.232 '24597377': order buy market 0.01 EURUSD sl: 0.00000 tp: 1.12054
0 21:30:11.423 '24597377': order buy market 0.01 EURUSD sl: 0.00000 tp: 1.12055
0 21:30:11.685 '24597377': order was opened : #1917571 buy 0.01 EURUSD at 1.11371 sl: 0.00000 tp: 1.12054
1 21:30:12.023 '24597377': order buy 0.01 EURUSD opening at market sl: 0.00000 tp: 1.12055 failed [Off quotes]
0 21:45:11.726 '24597377': order sell market 0.01 EURUSD sl: 1.30351 tp: 0.00000
0 21:45:11.726 '24597377': order buy market 0.01 EURUSD sl: 0.99624 tp: 0.00000
0 21:45:11.804 '24597377': order buy market 0.01 EURUSD sl: 0.99624 tp: 0.00000
0 21:45:12.242 '24597377': order was opened : #1917632 sell 0.01 EURUSD at 1.11182 sl: 1.30351 tp: 0.00000
1 21:45:12.242 '24597377': order buy 0.01 EURUSD opening at market sl: 0.99624 tp: 0.00000 failed [Off quotes]
1 21:45:12.242 '24597377': order buy 0.01 EURUSD opening at market sl: 0.99624 tp: 0.00000 failed [Off quotes]
0 22:00:11.607 '24597377': order buy market 0.01 EURUSD sl: 0.96432 tp: 0.00000
0 22:00:11.676 '24597377': order buy market 0.01 EURUSD sl: 0.96432 tp: 0.00000
1 22:00:12.062 '24597377': order buy 0.01 EURUSD opening at market sl: 0.96432 tp: 0.00000 failed [Off quotes]
0 22:00:12.378 '24597377': order was opened : #1917652 buy 0.01 EURUSD at 1.11299 sl: 0.96432 tp: 0.00000
I've attached the EA so you can see the code.
Thanks for your time.
- Kiwitrade7