Stefano Cerbioni: Hi, why in my script ,the high[] not return a good high ?
The issue is that you are mixing series and non-series indexing.
In OnCalculate, the price arrays (high[], low[], etc.) are already in series mode (shift 0 = current bar), but your code changes their orientation and then calculates ATR with different indexing, which desynchronizes the values.
Always use the same indexing (either series or non-series, but consistent) and return rates_total instead of rates_total - 1.
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, why in my script ,the high[] not return a good high ?