Hi,
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:
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…
Many thanks!
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. 🙂
if barindex >= 20 then
CCIindex = CCI[20](close)
MaxValue = max(Maxvalue, CCIindex)
endif
Above added to here
Snippet Link Library
Looks like others have added 6 to 8 links to the Library since I last entered a link … thank you to those folks! 🙂
Looks like others have added 6 to 8 links to the Library since I last entered a link
I thought that you’d done it but just didn’t tell anybody!
I did, but maybe some others too! 🙂