- When you post code please use the SRC button! Please edit your post.
General rules and best pratices of the Forum. - General - MQL5 programming forum int OnStart(){ .. int OnCalculate(const int rates_total, ...
Indicators use OnCalculate, which does nothing. They do not have an OnStart, it is never called.
Event Handling Functions - Functions - Language Basics - MQL4 Referenceint counted_bars = IndicatorCounted(); int pos= Bars - counted_bars; while(pos>=0){ dHigh = High[pos];
The first time counted_bars is zero so pos equals Bars and High[pos] is array exceeded.- Use OnCalculate and stop using IndicatorCounted.
See How to do your lookbacks correctly.
Thanks
I edited it and I'll try as you said.

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 was creating a simple indicator that will show High-Low for each bar but it doesn't do anything when I attach it to the chart. When I start debugging, debugging stops just after I press "Ok" for the indicator settings box.