AverageMishka
New member
Hi,
I'm looking to plot the avg of 3 moving averages and the other 2 moving averages instead of having them as 5 separate lines.
I'm looking to plot the avg of 3 moving averages and the other 2 moving averages instead of having them as 5 separate lines.
Code:
declare lower;
input length1 = 8.0;
input length2 = 24.0;
input length3 = 50.0;
input length4 = 113.0;
input length5 = 200.0;
input displace = 0;
input averageTypeE = AverageType.EXPONENTIAL;
input averageTypeW = AverageType.EXPONENTIAL;
def ema8 = ExpAverage(close, 8);
def ema24 = ExpAverage(close, 24);
def wma50 = WMA(close, 50);
def ema113 = ExpAverage(close, 113);
def wma200 = WMA(close, 200);
def price = close;
plot EMA8_ = ExpAverage(close, 8);
plot EMA24_ = ExpAverage(close, 24);
plot WMA50_ = WMA(close, 50);
plot EMA113_ = ExpAverage (close, 113);
plot WMA200_ = WMA(close, 200);
AddLabel(close, ”Stacked AVGs(CALLS)” , (if wma200 and price > ema113 and price > wma50 and price > ema24 and price > ema8 then Color.GREEN else Color.GRAY));
AddLabel(close, ”Stacked AVGs(PUTS)” , (if wma200 and price < ema113 and price < wma50 and price < ema24 and price < ema8 then Color.GREEN else Color.GRAY));
AddChartBubble(EMA8_ and EMA24_ and WMA50_ crosses above WMA200_ and EMA113_, close, "GO", Color.PINK);
AddChartBubble(EMA8_ crosses above WMA200_ and EMA113_, close, "9 Cross", Color.DARK_GREEN);
AddChartBubble(EMA24_ crosses above WMA200_ and EMA113_, close, "21 Cross", Color.LIGHT_GREEN);
AddChartBubble(WMA50_ crosses above WMA200_ and EMA113_, close, "50 Cross", Color.GREEN);
AddChartBubble(EMA8_ crosses below WMA200_ and EMA113_, close, "9 Cross", Color.DARK_RED);
AddChartBubble(EMA24_ crosses below WMA200_ and EMA113_, close, "21 Cross", Color.LIGHT_RED);
AddChartBubble(WMA50_ crosses below WMA200_ and EMA113_, close, "50 Cross", Color.RED);
AddChartBubble(EMA8_ and EMA24_ and WMA50_ crosses below WMA200_ and EMA113_, close, "BYE", Color.BLUE);