while(n<6 || i<=shift+1000)
- Maybe not letting i go through Bars (array range exceeded)
- You exit the loop when you get to 6 fractals but only return a result if there are EXACTLY 5 fractals.
- Change the title. You are not calculating ATR (by its definition) You are calculating average of a trend channel width (or something similar.)
- What is the value of
MathAbs(P4-P4)
Thanks - as I said just getting a look and feel of the nature of the problem as far as the title is concerned.
I think there is a better stratergy to get at the solution but at the moment I cant see it.
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
The following code for an indicator just kept crashing / suspending (infinite loop, too many calcultion???)
Can someone suggest a better coding practise to get a better result.
Code is not tidy as it has been copy and pasted from different places and played with to see if I can get a quick overview of result / problems.
It looks like the icustom() function is not actually acessing the zigzag indicator even though I have checked that it is present, something to do with the new mt4 compiler I am not aware of perhaps?