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
for (i = 0; i < ordersTotal; i++) { //select the order if(OrderSelect(i,SELECT_BY_POS, MODE_TRADES)) { //get the right order if(OrderSymbol() == Symbol()) { //remember the old stop loss. originalSP = OrderStopLoss(); //update the stop loss if(OrderType() == OP_BUY) { newSP = Bid-(Point * 30); if(originalSP > newSP) { newSP = originalSP; } }else if(OrderType() == OP_SELL) { newSP = Bid+(Point * 30); if(originalSP < newSP) { newSP = originalSP; } } Print("new stop loss for ",Symbol(), " at ", newSP); if(!OrderModify(OrderTicket(), OrderOpenPrice(),newSP, OrderTakeProfit(), 0, Green)) { Print("OrderModify returned the error of ",GetLastError()); } //exit the loop break; } }else{ Print("OrderSelect returned the error of ",GetLastError()); } }