I have this piece of code:
I open a pending order with expiration, then modify the order with SL and TP. The problem is that the expiration is deleted and if I put the expiration in the OrderModify, the TP will not be set.
How I can fix the code to set the SL, TP and expiration at the same time?
Inserted Code
ticket = OrderSend(Symbol(), OP_SELLLIMIT, tradedLots, Bid + StopLossSell * myPoint, Slippage, 0, 0, "Sell(#" + MagicNumber + ")", MagicNumber, expiration, DeepPink);
if(ticket>0)
{
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) {
OrderModify(ticket, OrderOpenPrice(), 0, OrderOpenPrice() - TP * myPoint, 0, Red);
Print("SELL Order opened : ",OrderOpenPrice());
}
}
else Print("Error opening SELL Order : ",GetLastError()); I open a pending order with expiration, then modify the order with SL and TP. The problem is that the expiration is deleted and if I put the expiration in the OrderModify, the TP will not be set.
How I can fix the code to set the SL, TP and expiration at the same time?
Today I BUY, tomorrow I SELL!