使用Python + MetaTrader5库 批量修改止盈止损
import MetaTrader5 as mt5if not mt5.initialize():
print("MT5初始化失败")
quit()
positions = mt5.positions_get()
for pos in positions:
new_sl = 1.2000
new_tp = 1.3000
request = {
"action": mt5.TRADE_ACTION_SLTP,
"position": pos.ticket,
"sl": new_sl,
"tp": new_tp,
}
result = mt5.order_send(request)
print(f"修改订单 {pos.ticket} 结果: {result}")
批量修改,谢谢 不断学习。不断充电
页:
[1]