Close sell limit on python using mt5 library

 
Hi, I work on Python using the MT5 library. I have found how to put a buy/sell limit/stop order but I don't find how to close it when it is placed but not already executed? How can I remove the placed order please?


# OPEN THE ORDER

request = {
    "action": mt5.TRADE_ACTION_PENDING,
    "symbol": symbol,
    "volume": 1.0,
    "type": mt5.ORDER_TYPE_SELL_LIMIT,
    "price": mt5.symbol_info_tick(symbol).bid+100*point,
    "deviation": deviation,
    "type_filling": filling_type,
    "type_time": mt5.ORDER_TIME_GTC,
}

info_order = mt5.order_send(request)
info_order

EXIT:

OrderSendResult(retcode=10009, deal=0, order=50063572663, volume=1.0, price=0.0, bid=0.0, ask=0.0, comment='Request executed', request_id=47, 
retcode_external=0, request=TradeRequest(action=5, magic=0, order=0, symbol='EURUSD', volume=1.0, price=1.10519, stoplimit=0.0, sl=0.0, 
tp=0.0, deviation=10, type=3, type_filling=1, type_time=0, expiration=0, comment='', position=0, position_by=0))

Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Order Properties
Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Order Properties - Trade Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

View MQL5 help on Trade Operation Types

ENUM_TRADE_REQUEST_ACTIONS

Identifier

Description

TRADE_ACTION_DEAL

Place a trade order for an immediate execution with the specified parameters (market order)

TRADE_ACTION_PENDING

Place a trade order for the execution under specified conditions (pending order)

TRADE_ACTION_SLTP

Modify Stop Loss and Take Profit values of an opened position

TRADE_ACTION_MODIFY

Modify the parameters of the order placed previously

TRADE_ACTION_REMOVE

Delete the pending order placed previously

TRADE_ACTION_CLOSE_BY

Close a position by an opposite one

Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Trade Operation Types
Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Trade Operation Types
  • www.mql5.com
Trade Operation Types - Trade Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Reason: