Maybe the "continue" doesn't belong there -- continue takes you directly to the next iteration of the innermost loop, so the closing part wouldn't be executed according to the vague code sample above.

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, I m new to metatrader, but i m a programmer since 5 years. I tried to make an expert advisor but i don't know why it stop.
Log ex:
2010.10.18 14:13:21 daily5 EURUSD,M1: modify #5559770 sell 1.00 EURUSD at 1.4020 sl: 1.4047 tp: 0.0000 ok
2010.10.18 14:13:21 daily5 EURUSD,M1: modifing stoploss order Bid=> 5559770 stopLoss 1.4047
2010.10.18 14:13:21 daily5 EURUSD,M1: check close ticket 5559770 i 0
2010.10.18 14:13:21 daily5 EURUSD,M1: time => 1287389597
2010.10.18 14:13:21 daily5 EURUSD,M1: execution => 1287389597
2010.10.18 14:13:19 daily5 EURUSD,M1: initialized
2010.10.18 14:13:19 daily5 EURUSD,M1 inputs: locked=false; openDate=0; firstGain=17; pathGain=5; period=50; loss1=100; loss2=150;
2010.10.18 14:13:21 daily5 EURUSD,M1: modify #5559770 sell 1.00 EURUSD at 1.4020 sl: 1.4047 tp: 0.0000 ok
2010.10.18 14:13:21 daily5 EURUSD,M1: modifing stoploss order Bid=> 5559770 stopLoss 1.4047
2010.10.18 14:13:21 daily5 EURUSD,M1: check close ticket 5559770 i 0
2010.10.18 14:13:21 daily5 EURUSD,M1: time => 1287389597
2010.10.18 14:13:21 daily5 EURUSD,M1: execution => 1287389597
2010.10.18 14:13:19 daily5 EURUSD,M1: initialized
2010.10.18 14:13:19 daily5 EURUSD,M1 inputs: locked=false; openDate=0; firstGain=17; pathGain=5; period=50; loss1=100; loss2=150;
After this code me program use to stop and I don't know why
if(OrderType() == OP_SELL){
pipsLoss = Bid - OrderOpenPrice();
if(pipsLoss >= loss1){
Print("closing order => ", OrderTicket(), " loss >", loss1);
closePos(i);
continue;
}
stopLoss = Bid + (loss2 * Point);
Print("modifing stoploss order Bid=> ", OrderTicket(), " stopLoss ", stopLoss);
OrderModify(OrderTicket(),OrderOpenPrice(),stopLoss,OrderTakeProfit(),0,Blue);
continue;
}
Why am I wrong ?
Thanks
David