why this simple buy and sell doesnt work ? please help

 

hello, I have written this simple program but when I run it on the chart it does not sell or buy


fa2

 

Ordersend function returns a value.

int ticket=OrderSend(....
 
Marco vd Heijden:

Ordersend function returns a value.

wow you solved it thank you, can you tell me what does this int ticket do in brief ?
 

Exactly what the documentation say's.

https://docs.mql4.com/trading/ordersend

Returned value

Returns number of the ticket assigned to the order by the trade server or -1 if it fails. To get additional error information, one has to call the GetLastError() function.

OrderSend - Trade Functions - MQL4 Reference
OrderSend - Trade Functions - MQL4 Reference
  • docs.mql4.com
Returns number of the ticket assigned to the order by the trade server or -1 if it fails. To get additional error information, one has to call the GetLastError() function. At opening of a market order (OP_SELL or OP_BUY), only the latest prices of Bid (for selling) or Ask (for buying) can be used as open price. If operation is performed with a...
Reason: