Modifying SL/TP after CTrade.Buy/Sell New comment tomerg 2019.03.12 15:30 Hi All I'm using Buy/Sell like the following example. The problem is that although PositionModify return TRADE_RETCODE_DONE, it seems that the order does not have SL/TP assigned to it. What needs to be fixed with this approach? Thanks, if(m_trade.Buy(lot,m_symbol.Name(),0,0,0)) { if(m_trade.ResultDeal()==0) { Print("Buy -> false No Ticket. Result Retcode: ",m_trade.ResultRetcode(), ", description of result: ",m_trade.ResultRetcodeDescription()); return(false); } else { Print("Buy -> true. Order Result Retcode: ",m_trade.ResultOrder()," ",m_trade.ResultRetcode(), ", description of result: ",m_trade.ResultRetcodeDescription()); double price=m_trade.ResultPrice(); double osl=m_symbol.NormalizePrice(price-sl); double otp=m_symbol.NormalizePrice(price+tp); PrintFormat("Placing Modify with price %f sl %f tp %f",price,osl,otp); m_trade.PositionModify(m_trade.RequestPosition(),osl,otp); if (TRADE_RETCODE_DONE!=m_trade.ResultRetcode()) { Print("Modify -> false. Result Retcode: ",m_trade.ResultRetcode(), ", description of result: ",m_trade.ResultRetcodeDescription()); return(false); } return(true); } } else { Print("Buy -> false. Result Retcode: ",m_trade.ResultRetcode(), ", description of result: ",m_trade.ResultRetcodeDescription()); return(false); } Modifying TP and keeping current SL Modifying filled order Need Help! New comment
Hi All
I'm using Buy/Sell like the following example.
The problem is that although PositionModify return TRADE_RETCODE_DONE, it seems that the order does not have SL/TP assigned to it.
What needs to be fixed with this approach?
Thanks,