khramkov/MQL5-JSON-API

how to define position ID?

xkkubicek opened this issue · 2 comments

Hi, first thank you for the perfect work. Could you please give me a hint how can I distinguish orders of one symbol? I want to close each trade at different time. If I use POSITION_CLOSE_SYMBOL , it closes all opened positions of the symbol. I tried to use POSITION_CLOSE_ID, but not successfully. I have no idea how can I define ID for simple positions.
Thanks

K. Kubicek

Hi, thanks.

api = MTraderAPI()
api.construct_and_send(action="TRADE", actionType="POSITION_CLOSE_ID", symbol="EURUSD", id=1034161189)

it works...thanks