Because i==0 is false from the start and the loop is never executed.
You should use i>=0
It works as you wrote it.
Loop runs while condition is true.
In your case it goes like this:
- set i = 5
- if i == 0
- else
- exit loop
- decrement i
![Documentation on MQL5: Language Basics / Operators / Loop Operator for Documentation on MQL5: Language Basics / Operators / Loop Operator for](https://c.mql5.com/36/62/documentation-on-mql5-language__3.png)
Documentation on MQL5: Language Basics / Operators / Loop Operator for
- www.mql5.com
Loop Operator for - Operators - Language Basics - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
It was typo error, Thanks!
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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, can someone explain to me why this does not work?