Discussion of article "Processing of trade events in Expert Advisor using the OnTrade() function" - page 3

 
Strange...., why isn't it shown how to track closing a position by stop or take?
 
Tango_X:
Strange...., why is it not shown how to track position closing by stop or take?

The article was written a long time ago. Since then a new feature has appeared

Starting frombuild 1625 there is a wonderful enumeration ENUM_DEAL_REASON:

ENUM_DEAL_REASONReason description
......
DEAL_REASON_SLThe operation was performed as a result of Stop Loss triggering.
DEAL_REASON_TPThe operation was executed as a result of Take Profit triggering
......

which can be tracked in OnTradeTransaction.


Example of operation: Stop Loss Take Profit

 
Vladimir Karputov:

The article was written a long time ago. Since then, a new opportunity has arisen

Starting withbuild 1625 there is a wonderful enumeration ENUM_DEAL_REASON:

ENUM_DEAL_REASONReason description
......
DEAL_REASON_SLThe operation was performed as a result of Stop Loss triggering.
DEAL_REASON_TPThe operation was executed as a result of Take Profit triggering
......

which can be tracked in OnTradeTransaction.


Example of operation: Stop Loss Take Profit

super! thanks!!!

 
Vladimir Karputov:

The article was written a long time ago. Since then, a new opportunity has arisen

Starting withbuild 1625 there is a wonderful enumeration ENUM_DEAL_REASON:

ENUM_DEAL_REASONReason description
......
DEAL_REASON_SLThe operation was performed as a result of Stop Loss triggering.
DEAL_REASON_TPThe operation was executed as a result of Take Profit triggering
......

which can be tracked in OnTradeTransaction.


Example of operation: Stop Loss Take Profit

One more question along the way.

I use the "Comments" field in a position to store the period of opening this position, and when Stop Loss/Take Profit is triggered, the terminal writes st/tp in this field. How to forbid the terminal and broker to change the comment? Or maybe you know another way to store the period for each position?

 
in mql5 I can't complete this thing. How to recognise only new orders irrespective of comments and majic #, I have at closing buy signalling that sell came in (and vice versa).
This website uses cookies. Learn more about our Cookies Policy.