Using Limit orders to scale out partial profit implies that I must cancel these limit orders if the base trade goes to stoploss.
I checked OnTrade() and OnTradeTransaction() but did not get any wiser. Constantly monitoring the "base" trade seems an awkward way of doing it.
Advise someone?
Agree, not trivial. I think I will save the ticket number for the "Base" transaction in the comment section of the limit out order(s). The time between an actual SL of the base order
and coming close to the limit out order(s) gives me time to check my current limit orders and check if the base order still is alive, I have a timing routine for 1 minute. And if I am late on some occasion
that can be handled. There should never be a position for an order containing a ticket number. Just kill it if it appears
Love your comment in the post you linked to:
"Dont religiously believe what a computer tells you" :-)
Agree, not trivial. I think I will save the ticket number for the "Base" transaction in the comment section of the limit out order(s). The time between an actual SL of the base order
and coming close to the limit out order(s) gives me time to check my current limit orders and check if the base order still is alive, I have a timing routine for 1 minute. And if I am late on some occasion
that can be handled. There should never be a position for an order containing a ticket number. Just kill it if it appears
Love your comment in the post you linked to:
"Dont religiously believe what a computer tells you" :-)
![](https://c.mql5.com/3/27/wink__4.gif)
![Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties](/i/community/logo_mql5_small.png)
- www.mql5.com
It is actually simpler than that. Just check if there is a position alive for the pair in question. If not kill all pending orders for that pair. Coded it. Works if the "base" order is a market order and that is what I use.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Using Limit orders to scale out partial profit implies that I must cancel these limit orders if the base trade goes to stoploss.
I checked OnTrade() and OnTradeTransaction() but did not get any wiser. Constantly monitoring the "base" trade seems an awkward way of doing it.
Advise someone?