The terminal itself can't do multiple take profits, I've been developing an EA to change this (just released in the codebase). The other option is to have multiple trades with individual take profits
You can perform partial-close. Don't think you can do Partial-TP or Partial-SL orders. To partial close, simply specify a volume less-then the total volume of the order. Of course this lot-size have to be at least the brokers minimum transaction size.
There are two approaches
- Partial close the order. The problem is remembering if and when you last did the partial close. One is easy, I move the SL to BE+1 and THEN reduce. Subsequently no reduction because of the BE. More than once you'll have to either use persistent storage or recalculate the levels. Also the close amount and remaining amount must be multiple of lotstep and at least minlot. From my code:
bool CloseOrder(int ticket=EMPTY, double size=INF){ // INF == entire. if (ticket == EMPTY) ticket = OrderTicket(); else if (!OrderSelect(ticket, SELECT_BY_TICKET)){ Alert("OrderSelect(",ticket,",ticket) failed: ", GetLastError()); return(false); } double minLot = MarketInfo(chart.symbol, MODE_MINLOT), lotStep = MarketInfo(chart.symbol, MODE_LOTSTEP), sizeCurr = OrderLots(), sizeClose = MathRound(size/lotStep)*lotStep, sizeRem = sizeCurr - sizeClose; if (sizeClose < minLot) return(false); if (sizeRem < minLot){ sizeClose = sizeCurr; // Close all color op.color = IfI(Color.Buy, Color.Sell); } else op.color = Aqua; if (GetTradeContext() < TC_LOCKED) return(false); if (OrderClose( ticket, sizeClose, OrderClosePrice(), Slippage.Pips*pips2points, op.color )){ RelTradeContext(); return(true); } Alert("OrderClose(ticket=", ticket, ", ...) [1] failed: ", GetLastError()); RelTradeContext(); // After GetLastError return(false); }
- Open multiple orders. This is easier for multiple levels. Open all at once and manage each separately. If you use a different criteria for managing each leg (e.g. different SLs) then use a Range of magic numbers, in the orderSelect loop.
double maxLot = MarketInfo( Symbol(), MODE_MAXLOT ); // IBFX==50 Std/Mini double LotStep = MarketInfo( Symbol(), MODE_LOTSTEP ); #define PAIRS 2 // Open two orders, one half lot size each. for(int count=MathCeil(lots.new/(PAIRS*maxLot))*PAIRS; count>0; count--) { // 50.00+49.99=99.99 25.01+25.00+25.00+25.00=100.01 if (count>1) double size = MathCeil(lots.new/count/LotStep)*LotStep; else size = lots.new; lots.new -= size; // Remaining amount.
- There is also the question of wither you should do this at all. Most 'gurus' recommend, reward/risk ratio of at least 2:1. But when you do partial TPs most often the second leg results in no profit, so the reward becomes 1. But when the trade fails, you loose both. So the reward/risk ratio becomes 1:2. Just the opposite. Each time I optimized my ea, partial TP was not very helpful.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Dear Community,
Can someone speak to the topic of taking profits at multiple stages? I know how to place a S/L and T/P but wanting to know if MT4 is capable to set multiple partial T/P?
Thanks in advance if you can help.
Sincerely,
RRJ