engcomp:
It depends on the overall EA design; it's hard to generalize. What's important is that you understand the difference. If u do, then you'll be able to decide how well it fits your own EA.
In many EAs I have inspected, the first "continue" is replaced with "break".
Which should be preferred? Thank you, Helmut
Do I understand it correctly ? continue will jump out of the current cycle of the for loop and start the next one, and break will exit the for loop entirely ?
SDC:
Yes, but 'continue' will only start the next loop iteration if the loop condition still evaluates true.
Do I understand it correctly ? continue will jump out of the current cycle of the for loop and start the next one, and break will exit the for loop entirely ?
mentally replace 'continue' with 'skip' and 'break with 'stop/abort'. Life will be easier :)
cameofx:
mentally replace 'continue' with 'skip' and 'break with 'stop/abort'. Life will be easier :)
I think in BASIC there was "next" for continue and "exit" for break. Thank you for the comments.
mentally replace 'continue' with 'skip' and 'break with 'stop/abort'. Life will be easier :)
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
In MQL4 Documentation is this code snippet to illustrate the use of Symbol()... int total=OrdersTotal(); for(int pos=0;pos<total;pos++) { // check selection result because the order may be closed or deleted at this time! if(OrderSelect(pos, SELECT_BY_POS)==false) continue; if(OrderType()>OP_SELL || OrderSymbol()!=Symbol()) continue; // performs some processing... }In many EAs I have inspected, the first "continue" is replaced with "break".
Which should be preferred? Thank you, Helmut