When trying to change the SL or TP from a position using TRADE_ACTION_SLTP in python I ger NoneType as result

 

Hi everybody,

I am  new programming EA in python and I think that one of the most important procedures is to be able to change SL and TP from an open position.

I have opened positions with no problems, but once I try to change the SL or TP I get NoneType as a result.

This is the code I use in order to perform the change.

Thanks in advance!

request={ 
     "action": mt5.TRADE_ACTION_SLTP,
     "position": tradeID,
     "symbol": df.iloc[i]['symbol'],
     "sl": float(SL1),
     "tp": float(TP1),
     "magic": ordenMagia}
                    
                    
                    
                    
result=mt5.order_send(request)
if result.retcode != mt5.TRADE_RETCODE_DONE:
        print("Límite MQL5 actualizado: ", tradeID)
else:
        print("Fallo durante la actualización de límites MQL5.")
 

hello,

had similar problems

try int(tradeID) maybe this works.

 
Fxstrzelecka:

hello,

had similar problems

try int(tradeID) maybe this works.

Thank you very much!!!! Now it works perfect!!!!!