Close SELL order after opening a BUY order
For a start you should use
if ( OrderType() == OP_SELL && OrderCloseTime()==0){
to prevent trying to close an order that is already closed
if (!OrderClose(ticketSell,OrderLots(),OrderClosePrice(),0,clrCoral)) { // Chiusura ordine SELL
Use OrderClosePrice() instead of Ask as it will be current from the OrderSelect()
but I have errors 138 and 4108
When asking for help please look up and post what the error return codes mean. That way everybody who reads your post does not have to look them up.
I want to close SELL order after a BUY order is opened.
I wrote this code but I have errors 138 and 4108, how can I fix it?
ps: the orders are generated by SELL LIMIT and BUY LIMIT functions