PennyFlipper101
New member
I wrote this script to calculate the distance between price and weekly moving average, but it isn't fully registering on a scan or in a watchlist column but it still plots the number as a number if I use it as a study. How can I edit this to get the number shown in a watchlist column instead of NaN.
input Period = AggregationPeriod.WEEK;
input AvgType = AverageType.EXPONENTIAL;
input Length = 200;
input priceclose = close;
def ema1 = ExpAverage(close, 5);
def AVG = MovingAverage(AvgType, close(period = Period), Length);
plot distance = AbsValue(ema1-avg)/(ema1+avg/2)*100;
input Period = AggregationPeriod.WEEK;
input AvgType = AverageType.EXPONENTIAL;
input Length = 200;
input priceclose = close;
def ema1 = ExpAverage(close, 5);
def AVG = MovingAverage(AvgType, close(period = Period), Length);
plot distance = AbsValue(ema1-avg)/(ema1+avg/2)*100;