I’m hopeful someone can assist me with this task that keeps giving me errors.
I would like to find the highest value of the CCI[20](close) for all bars that are loaded minus 20 bars – so not to cause problems with the first 20 bars needed for the calculations.
Some of the code I’ve tried:
1
2
3
4
5
CCIindex=CCI[20](close)
Bars=BarIndex-20//(Gives me the max bars minus the first 20 bars to not cause problems)
MaxValue=HIGHEST[Bars](CCIindex)
And this is where it fails. I get error Null.
I’ve even tried a FOR / NEXT loop to count the bars in the loop and then use that number. But still – I can’t get it to work.
If I manually put in the maximum bars minus 20 in the HIGHEST[Bars] command, then it works.
What am I doing wrong? This should be a no brainer…
tested4perfection – welcome to the forums. Please use the ‘Insert PRT Code’ button when posting code in future posts as it makes it far easier for others to read. I have tidied up your post for you. 🙂