Bullish Bearish Trend Label



declare upper;
input Price = close;
input EMA_F = 8;
input EMA_S = 21;
input EMA_L = 50;


def EMAf = ExpAverage(Price, EMA_F);
def EMAs = ExpAverage(Price, EMA_S);
def EMAl = ExpAverage(Price, EMA_L);


def Condition1 = if (EMAf > EMAs && EMAs > EMAl, 1, 0);
def Condition2 = if (EMAf > EMAs && EMAs < EMAl, 1, 0);
def Condition3 = if (EMAf < EMAs && EMAs > EMAl, 1, 0);
def Condition4 = if (EMAf < EMAs && EMAs < EMAl, 1, 0);


plot null = double.nan;


AddChartLabel(yes, concat("EMA: ",  concat("",  
If Condition1 then "Strong Bullish Trend" else  
If Condition2 then "Weak Bullish Trend" else 
If Condition3 then "Weak Bearish Trend" else  
If Condition4 then "Strong Bearish Trend" else "Ranging")), 


If Condition1 then color.green else  
If Condition2 then  color.light_green else  
If Condition3 then color.pink else  
If Condition4 then  color.red else color.white);

No comments :

Post a Comment