When trying to change the SL or TP from a position using TRADE_ACTION_SLTP in python I ger NoneType as result
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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.")