if(), then orderselect, then ordermodify
You can either modify an order or you can send two orders, 1 with No SL but with TP, 2nd with SL but no TP.
Dark Ryd3r:
Hello, I am trying to find out which function i can use from mql5 which allows me to send
seperate Stop Loss and Take Profit orders?
I want to send SL and TP order not with the current order, but only when a condition is met.
Try this way:
// Set stop levels by condition for(int i=0;i<PositionsTotal();i++){ ulong iTicket=PositionGetTicket(i); if(PositionGetString(POSITION_SYMBOL)==_Symbol){ if(PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_BUY){ if(Condition==true){ double SL=YourSL...,TP=YourTP...; if(PositionGetDouble(POSITION_SL)!=SL||PositionGetDouble(POSITION_TP)!=0){ if(!trade.PositionModifiy(iTicket,SL,TP)){ Print(PositionModify error ",trade.ResultRetcode()); return; } } } } // Same for POSITION_TYPE_SELL. } }

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, I am trying to find out which function i can use from mql5 which allows me to send
seperate Stop Loss and Take Profit orders?
I want to send SL and TP order not with the current order, but only when a condition is met.
Thanks