Download MetaTrader 5

Getting no error but ordersend returns -1

To add comments, please log in or register
Fireche22
24
Fireche22  

Hello,

m‌y EA suddenly stopped placing orders so I am trying to debug and find out why not. OrderSend now seems to return -1 but when I add GetLastError() just after the OrderSend, nothing happens. What am I missing here?

Marco vd Heijden
Moderator
6132
Marco vd Heijden  
Some code.
Fireche22
24
Fireche22  

actually I just figured what caused the problem. I deleted magicNumber = 0 and expirationDate = 660 out of the OrderSend and now it seems to work again. Very weird. I think magicNumber = 0 is standard and expirationDate requries at least 660 seconds. 

‌‌OrderSend(symbol,OP_SELLSTOP,lot,sellstop,0,0,goal,comment,0,660) <-- this returned - 1

whroeder1
17097
whroeder1  
Not weird at all. 660 is  Thu, 01 Jan 1970 00:11:00 GMT. Your order would expire as soon as you placed it.
To add comments, please log in or register