bullman1083
New member
Hello,
Trying to make a custom label on my chart for when the close price is grater than 20% above the 20 DaySimpleMovingAverage on my daily chart, doesnt seem to be working when i test it, any help would be greatful, thanks. Here's what i have below ...
##########################################################################
### Price Greater than 20% above 20DayMovingAverage ###
def C = close;
def length = 20;
def avgtype = AverageType.SIMPLE;
def sma1 = MovingAverage(avgtype, close, length);
def prcnt20 = 100 - ( C / sma1) * 100;
def prcnt20go = prcnt20 > 20;
addLabel(yes, "$>20%^20dma", if prcnt20 then color.green else color.black );
#############################################################################
Trying to make a custom label on my chart for when the close price is grater than 20% above the 20 DaySimpleMovingAverage on my daily chart, doesnt seem to be working when i test it, any help would be greatful, thanks. Here's what i have below ...
##########################################################################
### Price Greater than 20% above 20DayMovingAverage ###
def C = close;
def length = 20;
def avgtype = AverageType.SIMPLE;
def sma1 = MovingAverage(avgtype, close, length);
def prcnt20 = 100 - ( C / sma1) * 100;
def prcnt20go = prcnt20 > 20;
addLabel(yes, "$>20%^20dma", if prcnt20 then color.green else color.black );
#############################################################################