It's pretty simple. Assign a custom code to the comment field or a different magicnumber to this first order. After that, if you don't have this magic number, you can close all orders. Or if there is no special code in the comment section, it's like close all orders.
Thank you Mehmet Bastem - the custom comment suggestion good idea.. am wondering how to give it to first openorder only...mmh
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
1. Loop through OrderHistory and see if any MagicNumber trade closed because of TP.
2. If so, close all other orders with the MagicNumber?
Thank you andrew - trying to get 1st open order closed by tp seems to be an issue.
It's pretty simple. Assign a custom code to the comment field or a different magicnumber to this first order. After that, if you don't have this magic number, you can close all orders. Or if there is no special code in the comment section, it's like close all orders.
Thank you Mehmet Bastem - the custom comment suggestion good idea.. am wondering how to give it to first openorder only...mmh
Thank you andrew - trying to get 1st open order closed by tp seems to be an issue.
Thank you Mehmet Bastem - the custom comment suggestion good idea.. am wondering how to give it to first openorder only...mmh
Closed because of TP?
Yes closed by TP... identifying the first open order, by magic number,symbol when it is closed by TP
This will work only if the TP or SL is never modified. Fails on trailing SLs. This will work only for buy orders.
This will work only if the TP or SL is never modified. Fails on trailing SLs. This will work only for buy orders.