# @shayankm
#indicator(title='Mega RSI [SHK]', shorttitle='Mega RSI [SHK]',timeframe="")
# Converted by Sam4Cok@Samer800 - 12/2022
Declare lower;
input EnableRSIma = no;#(false,title="Enable RSI MAs")
def na = Double.NaN;
def last = isNaN(close);
def i1 = 125;
def nRSI = rsi(Price=close,Length=14);
def rsidelta = nrsi - nrsi[9];
def rsisma = SimpleMovingAvg(rsi(Price=close,Length=3), 3);
def ci = rsidelta + rsisma;
plot hline = if last then na else 80;
hline.SetDefaultColor(Color.GREEN);
plot Lline = if last then na else 20;
Lline.SetDefaultColor(Color.RED);
def higherBullLine = 40;
def lowerBullLine = 33.33;
def lowerBearLine = 60;
def higherBearLine = 66.66;
AddCloud(if last then na else higherBearLine, lowerBearLine, Color.DARK_RED);
AddCloud(if last then na else higherBullLine, lowerBullLine, Color.DARK_GREEN);
plot llline = if last then na else 120;
llline.SetStyle(CURve.SHORT_DASH);
llline.SetDefaultColor(Color.GREEN);
plot Mhline = if last then na else 150;
Mhline.SetStyle(CURve.SHORT_DASH);
Mhline.SetDefaultColor(Color.GRAY);
plot hhline = if last then na else 180;
hhline.SetStyle(CURve.SHORT_DASH);
hhline.SetDefaultColor(Color.RED);
plot rsiLine = nrsi;
rsiLine.SetDefaultColor(Color.YELLOW);
rsiLine.SetLineWeight(2);
plot fastRSI = if EnableRSIma then SimpleMovingAvg(nRSI, 9) else na;
fastRSI.SetDefaultColor(Color.GREEN);
plot slowRSI = if EnableRSIma then ExpAverage(nRSI, 45) else na;
slowRSI.SetDefaultColor(Color.RED);
plot CompositeIndex = ci / 2 + i1;
CompositeIndex.SetLineWeight(2);
CompositeIndex.SetDefaultColor(Color.WHITE);
plot CiFast = SimpleMovingAvg(ci, 13) / 2 + i1;
CiFast.SetDefaultColor(Color.GREEN);
plot CiSlow = SimpleMovingAvg(ci, 33) / 2 + i1;
CiSlow.SetDefaultColor(Color.RED);
#---- END CODE