Need help with 200 SMA labels

Rich

Rich

New member
Green color Label= Candles over 20(SMA) and 20(SMA) over 200(SMA)

Red color Label = Candles under 20(SMA) and 20(SMA) under 200(SMA)

Labels appear as dot/circle on the top left corner of the chart and can work on all time frames.
 
mc01439

mc01439

Well-known member
2019 Donor
VIP
Code:
#Labels
input Showlabels = yes;
input price = close;
input length = 20;
input displace = 0;

input length_200 = 200;

DEF SMA = Average(price[-displace], length);
DEF SMA_200 = Average(price[-displace], length);

def waveUP = SMA > SMA_200 and close > SMA;
def waveDN = SMA < SMA_200 and close < SMA;
def wavenet = !waveUP and !waveDN;

AddLabel(Showlabels and  waveUP, "SMA = Bullish", Color.GREEN);
AddLabel(Showlabels and  waveDN, "SMA = Bearish", Color.RED);
AddLabel(Showlabels and  wavenet, "SMA = Neutral", Color.YELLOW);
 
Last edited by a moderator:
Rich

Rich

New member
@mc01439 May you be blessed with health and huge fortunes!!!! Thank you so much
 

Similar threads

Top