Pantelis Papaisidorou:
Given that I have the ticket number, how do I get a return true/false, 0/1, whatever.... to make code that acts accordingly, if the order has close by stoploss or takeprofit.
The only way that I am aware of is by reading the OrderComment().
It will have either sl or tp (usually [sl] or [tp], but I haven't checked all brokers) in the comment.
The problem is that the broker can change the comment, but I have never come across any broker that removes the sl or tp
- Reading the comment works only on those brokers that add that. Some do not.
- Select the order and see whether the close price is closer to the SL than the TP.
William Roeder:
- Reading the comment works only on those brokers that add that. Some do not.
I contacted the service desk years ago regarding this and they informed me that the platform automatically adds sl or tp to the order comment, so according to Metaquotes, it is not the broker that adds it.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello,
As the topic's titles suggests, I am having trouble with a specific issue.
Given that I have the ticket number, how do I get a return true/false, 0/1, whatever.... to make code that acts accordingly, if the order has close by stoploss or takeprofit.
Anyone knows?
Thanks in advance,
PP