Mr_Wheeler
Active member
"Ck 1st" is abbreviation for "Check first", "9 Abv 200" simply means that the 9 MDA is above 200.
Code:
# avgs_per_diff_00
declare lower;
input avg1Type = Averagetype.simple;
input avg2type = Averagetype.simple;
input Avg1Length = 9;
input Avg2Length = 50;
def avg1 = MovingAverage(avg1Type, close, avg1Length);
def avg2 = MovingAverage(avg2Type, close, avg2Length);
def avgup = (avg1 > avg2);
#def AvgPercent = MovingAverage(avg1Type, close, avg1Length)-MovingAverage(avg2Type, close, avg2Length);
# plot percentDiff = (absValue(avgPercent)/movingaverage(avg1type,close,avg1length)) *100;
def Avg12diff = avg1 - avg2;
plot percentDiff = (absValue(avg12diff)/avg1) *100;
percentDiff.DefineColor("Up", color.green);
percentDiff.DefineColor("Down", color.red);
percentDiff.AssignValueColor(if avgup then percentDiff.color("up") else percentDiff.color("down"));
AssignBackgroundColor(if Avg1 is greater than or equal to Avg2 then (CreateColor(0, 102, 0)) else Color.light_GRAY);
.