Of course not.
They are used in a loop :
"continue" means stop the current iteration and continue to the next one.
"break" means, stop the loop.
Alain Verleyen:
Of course not.
They are used in a loop :
"continue" means stop the current iteration and continue to the next one.
"break" means, stop the loop.
Oh.. thanks
but in the following code, why not use the continue instead of break??
input int Slippage = 5; //+------------------------------------------------------------------+ //| CLOSE ALL OPENED POSITIONS | //+------------------------------------------------------------------+ void CloseAllOpened() { int total = OrdersTotal(); for(int i=total-1; i>=0; i--) { int ticket = OrderSelect(i,SELECT_BY_POS); int type = OrderType(); bool result = false; switch(type) { //Close opened long positions case OP_BUY : result = OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),Slippage,clrNONE); break; //Close opened short positions case OP_SELL : result = OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),Slippage,clrNONE); } if(result==false) { Alert("Order ",OrderTicket()," failed to close. Error: ",GetLastError()); Sleep(2000); } } }
Mohammad Soubra:
but in the following code, why not use the continue instead of break??
The operator 'break' stops the execution of the nearest external operator of 'while', 'for' or 'switch' type. The execution of the operator 'break' consists in passing the control outside the compound operator of 'while', 'for' or 'switch' type to the nearest following operator. The operator 'break' can be used only for interruption of the execution of the operators listed above.
The "break" in your code is not in the "for" loop, it is in the "switch". It only breaks from the nearest execution loop.
"Continue" is not syntactically correct for a Switch operator, only a while or for loop

Operator 'break' - Operators - MQL4 Tutorial
- book.mql4.com
Operator 'break' - Operators - MQL4 Tutorial
ok boss

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
in meta trader 4:
does the operator
continue;
similar to the operator
break;