#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);