declare lower; input RSI_Period = 21; input Slow_Factor = 8; input QQE = 4.236; def Wilder_Period = RSI_Period * 2 - 1; def vClose = vwap; def rsi = RSI(price = vClose, length = RSI_Period).RSI; def rsi_ma = MovingAverage(AverageType.EXPONENTIAL, rsi, Slow_Factor); def atr_rsi = AbsValue(rsi_ma[1] - rsi_ma); def atr_rsi_ma = MovingAverage(AverageType.EXPONENTIAL, atr_rsi, Wilder_Period); def dar = MovingAverage(AverageType.EXPONENTIAL, atr_rsi_ma, Wilder_Period) * QQE; def DeltaFastAtrRsi = dar; def RSIndex = rsi_ma; def newshortband = RSIndex + DeltaFastAtrRsi; def newlongband = RSIndex - DeltaFastAtrRsi; def longband = if RSIndex[1] > longband[1] and RSIndex > longband[1] then max(longband[1],newlongband) else newlongband; def shortband = if RSIndex[1] < shortband[1] and RSIndex < shortband[1] then min(shortband[1], newshortband) else newshortband; def trend = if Crosses(RSIndex, shortband[1]) then 1 else if Crosses(longband[1], RSIndex) then -1 else if !IsNAN(trend[1]) then trend[1] else 1; def FastAtrRsiTL = if trend == 1 then longband else shortband; plot pRsiMa = rsi_ma; plot pFastAtrRsiTL = FastAtrRsiTL; plot Diff = prsima - pfastAtrRsiTL; plot line50 = 50; pRsiMa.SetDefaultColor(CreateColor(113,225,180)); pFastAtrRsiTL.SetDefaultColor(CreateColor(225,109,47)); Diff.SetDefaultColor(GetColor(5)); Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM); Diff.SetLineWeight(3); Diff.DefineColor("Positive and Up", Color.GREEN); Diff.DefineColor("Positive and Down", Color.DARK_GREEN); Diff.DefineColor("Negative and Down", Color.RED); Diff.DefineColor("Negative and Up", Color.DARK_RED); Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.color("Positive and Up") else Diff.color("Positive and Down") else if Diff < Diff[1] then Diff.color("Negative and Down") else Diff.color("Negative and Up"));