Difference between TRADE_ACTION_DEAL and TRADE_ACTION_CLOSE_BY for closing position?

 

Hello,

All is in the title. If anyone can explain, when closing a position, the difference between TRADE_ACTION_DEAL and TRADE_ACTION_CLOSE_BY.

Apparently is it the same? In the Trade.mqh file, it is closing using TRADE_ACTION_DEAL. With my broker, in certain occasions, Trade.ClosePosition opened an opposite position. So I'm trying to change this with TRADE_ACTION_CLOSE_BY, but is is a wild guess.


So if anybody could put some light on this. What should I use? TRADE_ACTION_CLOSE_BY or TRADE_ACTION_DEAL?


Thanks.

 

TRADE_ACTION_CLOSE_BY : Сlose a position by an opposite one

It used for account allow hedge.

 
Nguyen Nga:

TRADE_ACTION_CLOSE_BY : Сlose a position by an opposite one

It used for account allow hedge.

Thank you.
Reason: