// getting position data here.... symbol, TP, ticket...
// and all values are checked.
// pos_symbol != ""
// long pos_ticket = PositionGetInteger...
// new_suggested_SL = pos_OpenPrice ± (N * symbol_point) , N is integer
ModifyReq.action = TRADE_ACTION_SLTP;
ModifyReq.position = pos_ticket;
ModifyReq.symbol = pos_symbol;
ModifyReq.magic = magic;
ModifyReq.sl = new_suggested_SL; // calculated above
ModifyReq.tp = pos_TakeP; // current TP price of position
if(OrderCheck(ModifyReq, ModifyRes)) // never evaluated to be true !
m_trade.PositionModify(pos_ticket, new_suggested_SL, pos_TakeP); // only SL is adjusted
else Print("Order_Check_RetCode = ", ModifyRes.retcode); // which is always equal to 10013 : TRADE_RETCODE_INVALID
when this 10013 retcode is returned ? and what does it mean a trade being INVALID ?
Sorry, my bad.I was not doing it the same way trade.mqh is filling the request structure.for anyone making my mistake when using ordercheck() function before doing trade operations, elements of the request structure must be initiated to zero, or just ZeroMemory()ed.