This indicator displays the RSI oscillator, with an option to smoothed it or not, in candlesticks form. Keltner bands are added to the oscillator to act as trend filtering and to detect high/low volatility phases of the market.
//PRC_RSI candles w KeltnerChan | indicator
//08.11.2018
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
// --- settings
RSIp = 14 //RSI period
SmoothPeriod = 3 //Smoothing period (0=no smoothing)
SmoothType = 1 //Moving average type for smoothing
lengthKC = 14 //Keltner bands Period
multKC = 1.5 //Keltner bands multiplier
// --- end of settings
SmoothPeriod=max(SmoothPeriod,1)
rsiH = average[SmoothPeriod,SmoothType](rsi[RSIp](high))
rsiL = average[SmoothPeriod,SmoothType](rsi[RSIp](low))
rsiO = average[SmoothPeriod,SmoothType](rsi[RSIp](open))
rsiC = average[SmoothPeriod,SmoothType](rsi[RSIp](close))
drawcandle(rsiO,rsiH,rsiL,rsiC)
price = (rsiH+rsiL+rsiC)/3
iRange = abs(rsiH-rsiL)
MA = Average[lengthKC](price)
UpperBand = MA + Average[lengthKC](iRange)*multKC
LowerBand = MA - Average[lengthKC](iRange)*multKC
return UpperBand coloured(168,168,168) style(dottedline,1) as "UpperBand",LowerBand coloured(168,168,168) style(dottedline,1) as "LowerBand",MA coloured(168,168,168) style(dottedline,1) as "Center"