Closing MT5 Position from Python Failing

 

Hi

I have created a trading platform that automatically trades my strategies.

I can open trades, but each time I try and close then, it fails.

Open Position (Report extracted from the trade tab on the MT5 terminal):

Symbol Position Time Type Volume Price S / L T / P Market Price Swap Profit Comment
GBPUSD 8507493 2023.04.07 20:43:54 sell 0.01  1.24181  1.24281  1.23931  1.24234 0.00 - 0.43 Open - Strategy


Close the above Position:

The deviation is calculated as 50% of the spread.

request = {'action': 1, 'symbol': 'GBPUSD', 'volume': 0.01, 'type': 0, 'position': 8507493, 'price': 1.24214, 'deviation': 35, 'magic': 986532, 'comment': 'Close - Strategy Test', 'type_time': 0, 'type_filling': 1}

result = mt5.order_send(request)

The above "result" keeps returning None, so the closing of the position fails.

Any idea or feedback would be greatly appreciated.

Thanks