Simple Indicator That Won't Update!

 

It's time to appeal to smarter programmers than myself.  I have been working on this ADR (Average Daily Range) indicator, which draws lines at the upper and lower levels of the daily range.  I've been running it on 5-minute charts and although it paints the lines just fine when first dropped on the chart, it will not update the lines as new bars form!  I have spent hours trying to figure out the problem and can't find it.

Will one of you crack programmers please tell me how to fix this?  Here's the full code:

/////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

Forum on trading, automated trading systems and testing trading strategies

When you post code please use the CODE button (Alt-S)!

Use the CODE button



 
Well, I was able to fix it myself   I just had to move what I had put into an outside function (ADRcalc()) back into the main body of the program, and that did it.  Don't know why it didn't work the other way, but at least I have it working now!
Reason: