Try this - bit of a guess on the context but might get you going!
double stopLoss; if(a>b) for(int i=0;i<OrdersTotal();i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break; if((OrderMagicNumber()=XXXX) && (OrderSymbol()=Symbol())) continue; if(OrderType()==OP_BUY) { if(OrderStopLoss()<y) stopLoss=z; OrderModify(OrderTicket(),OrderOpenPrice(),stopLoss,OrderTakeProfit(),0,Blue); return(0); } }
Good Luck
-BB-
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
hi guys.
am new to programming and have been playing around with MQL4. i seem to be hitting a wall with the code. am trying to have an order modified when condition "A" happens. however it does not to work. below is how my code would look like.
double stopLoss;
if(a>b)
for(int i=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
if(OrderMagicNumber()!=XXXX || OrderSymbol()!=Symbol()) continue;
if(OrderType()==OP_BUY)
if(OrderStopLoss()<y)
stopLoss=z;
OrderModify(OrderTicket(),OrderOpenPrice(),stopLoss,OrderTakeProfit(),0,Blue);
return(0);
}
could someone help me. thank you in advance