Python / MT5, how to close half a position? - page 3

 
Alain Verleyen #:

Why are you using a different filling mode for the close ?

You can only use allowed filling mode according to the symbol's settings. See https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#symbol_filling_mode

Thanks for your suggestion, here is what I have done:

print(mt5.symbol_info("BTCUSD"))

With this I could see that the min tick step (0.01)  and the filling type allowed (ORDER_FILLING_IOC).

So I modified my code accordingly and now it seems to work

Reason: