OnCalculate + #property strict: accessing volume or spread parameter value makes the indicator freezing
After further investigation, it turns out that
ArraySize(volume) = 0
ArraySize(spread) = 0
Since "volume" and "spread" vectors are empty, no doubt the indicator stops working with an "array out of range" error.
Conclusion : do not use 'volume' and 'spread' parameters from OnCalculate calls.
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
I wonder why accessing volume or spread parameter of the OnCalculate function makes the indicator freezing when compiled with "#property strict" property.
Have a try. When running, first tick shows alerts up to instruction: Alert("tick_volume[0]="+IntegerToString(tick_volume[0]));
Subsequent ticks show the indicator not working any more.
Conversely, compiling with "#property strict" being commented produces a running code at every tick.
What is going wrong?