Tracking Order trigger - page 2

 
Bilal Said:
Can you explain me how knowing the ticket number of each position will help him to know which if opened it?
Using comment is the fast way to do it without modifying the logic of his ea. 
The best way is magic number off course. 

By simple code logic! In the code you simply track which logic state enabled the signal, and track the ticket number that was produced by that trade.

You can also make it more organized and use a structure to track the logic state, the signal and the resulting ticket as a single variable.

 
Fernando Carreiro:

By simple code logic! In the code you simply track which logic state enabled the signal, and track the ticket number that was produced by that trade.

You can also make it more organized and use a structure to track the logic state, the signal and the resulting ticket as a single variable.

THANKS GUY.


solved it using comment with string variable. 

 
AdnanSyed: THANKS GUY. solved it using comment with string variable. 

Did I not just warn you to the possible problems that you may face with brokers changing the Order Comments?

Forum on trading, automated trading systems and testing trading strategies

Tracking Order trigger

Fernando Carreiro, 2018.12.04 20:58

You should not rely on Order Comments at all as brokers can easily change them or even remove them completely! So why suggest such a limited solution when there is already the Ticket Number and/or Magic Number that is the correct way to implement it and is guaranteed to work every time on every broker?

Reason: