I'm having trouble conceptualizing something that seems simple. I want to color a moving average based on it's acceleration or deacceleration regardless of direction which I guess would be a rate of change > or < the previous rate of change. Something along the lines of.
def rateofchange = abs(price[1] - price[2]);
def rateofchange2 = abs(price[2] - price[3]);
if rateofchange > rateofchange2 then color green else rateofchange < rateofchange2 color red else color white
I would like to do this with a moving average but I'm lost on how to approach this. Any thoughts from anyone?
Thanks
def rateofchange = abs(price[1] - price[2]);
def rateofchange2 = abs(price[2] - price[3]);
if rateofchange > rateofchange2 then color green else rateofchange < rateofchange2 color red else color white
I would like to do this with a moving average but I'm lost on how to approach this. Any thoughts from anyone?
Thanks