Put RefreshRates(); between two commands OrderSend.
Actually, you can take the guessing out completely by using GetLastError()
Roger:
Put RefreshRates(); between two commands OrderSend.
Put RefreshRates(); between two commands OrderSend.
Thank you my son
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Hello Guys,
my OrderSend command sometimes returns -1 and sometimes goes trough.
What does return code -1 mean please ?
This is from expert log:
param 0 - param 10 are parameter and their values for OrderSend;param 0=Symbol. The EA was attached to EURUSD chart.
As you can see, the first order is executed the 2nd not .
first order
02:02:03 mtAPIServerEA EURUSD,M1: param 0=EURUSD
02:02:03 mtAPIServerEA EURUSD,M1: param 1=0
02:02:03 mtAPIServerEA EURUSD,M1: param 2=2.000000
02:02:03 mtAPIServerEA EURUSD,M1: param 3=1.30020000
02:02:03 mtAPIServerEA EURUSD,M1: param 4=50
02:02:03 mtAPIServerEA EURUSD,M1: param 5=0.000000
02:02:03 mtAPIServerEA EURUSD,M1: param 6=0.000000
02:02:03 mtAPIServerEA EURUSD,M1: param 7=
02:02:03 mtAPIServerEA EURUSD,M1: param 8=0
02:02:03 mtAPIServerEA EURUSD,M1: param 9=0
02:02:03 mtAPIServerEA EURUSD,M1: param 10=-1
02:02:03 mtAPIServerEA EURUSD,M1: OrderSend
02:02:03 mtAPIServerEA EURUSD,M1: price=1.30020000
02:02:03 mtAPIServerEA EURUSD,M1: open #8006542 buy 2.00 EURUSD at 1.3002 ok
second order
02:02:04 mtAPIServerEA EURUSD,M1: new incoming command...
02:02:04 mtAPIServerEA EURUSD,M1: param 0=EURUSD
02:02:04 mtAPIServerEA EURUSD,M1: param 1=0
02:02:04 mtAPIServerEA EURUSD,M1: param 2=2.000000
02:02:04 mtAPIServerEA EURUSD,M1: param 3=1.30020000
02:02:04 mtAPIServerEA EURUSD,M1: param 4=50
02:02:04 mtAPIServerEA EURUSD,M1: param 5=0.000000
02:02:04 mtAPIServerEA EURUSD,M1: param 6=0.000000
02:02:04 mtAPIServerEA EURUSD,M1: param 7=
02:02:04 mtAPIServerEA EURUSD,M1: param 8=0
02:02:04 mtAPIServerEA EURUSD,M1: param 9=0
02:02:04 mtAPIServerEA EURUSD,M1: param 10=-1
02:02:04 mtAPIServerEA EURUSD,M1: OrderSend
02:02:04 mtAPIServerEA EURUSD,M1: price=1.30020000
02:02:04 mtAPIServerEA EURUSD,M1: OrderSend ticket=-1
Any ideas ?
Thank you