This can not possibly be a new problem but I have not found a good solution searching.
I am "porting" an MT4 EA that takes 4 positions, theLimit for a last one running a trailing stop. This is straightforward in MQL4
So I start with opening a position "Buy" with 0.8 lots, stoploss entered, no takeprofit in order to scale out with four 0.2 positions.
So I turn to a suggested soluition of using "Sell Limit" to scale out. First problem in usiing the "CTrade" Class it seem to be that "price"
should be specified as a distance, not a level. Well it can be handled. Next problem is that the trade might not reach the specified level but instead go to StopLoss.
So I have to monitor the trades and in case of it going to SL I have to cancel the pending orders.
Or have I missed something? It seems I have to keep a lot of information in global variables in order to have control in case there is an interruption
Quite an increase in complexity compared to MT4. Especially since it is an"MultiCurrency" EA.
I might as well keep monitoring all trades constantly and just do partial closes. Maybe
You don't miss anything. Either use "sell limit" and cancel pending order if SL is triggered, or monitor the trades and do partial closes.
Thanks angevoyageur.
Understand german?
"Warum etwas einfach machen wenn man es so schön kompliziert machen kann"
I am not German but this phrase has some beauty to it :-)
Thanks angevoyageur.
Understand german?
"Warum etwas einfach machen wenn man es so schön kompliziert machen kann"
I am not German but this phrase has some beauty to it :-)
![](https://c.mql5.com/3/26/smile__1.gif)
![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
This can not possibly be a new problem but I have not found a good solution searching.
I am "porting" an MT4 EA that takes 4 positions, theLimit for a last one running a trailing stop. This is straightforward in MQL4
So I start with opening a position "Buy" with 0.8 lots, stoploss entered, no takeprofit in order to scale out with four 0.2 positions.
So I turn to a suggested soluition of using "Sell Limit" to scale out. First problem in usiing the "CTrade" Class it seem to be that "price"
should be specified as a distance, not a level. Well it can be handled. Next problem is that the trade might not reach the specified level but instead go to StopLoss.
So I have to monitor the trades and in case of it going to SL I have to cancel the pending orders.
Or have I missed something? It seems I have to keep a lot of information in global variables in order to have control in case there is an interruption
Quite an increase in complexity compared to MT4. Especially since it is an"MultiCurrency" EA.
I might as well keep monitoring all trades constantly and just do partial closes. Maybe