Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
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.")