// ================================================================================================================================================================================
// RSI VWMA INDICATOR
// ================================================================================================================================================================================
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// Original by © Xaviz
// Rewritten by Zettt
// Xaviz' original version is based on the VWAP. This modification calculate the RSI of a volume-weight moving average instead, since the VWAP does not work well on higher time frames.
// It is recommended to adjust the settings.
//@version=4
study(title="RSI-VWMA", shorttitle="RSI-VWMA")
// Initial inputs
RSI_length = input(20, "RSI Length")
RSI_VWMA_oversold = input(20, "RSI Oversold Level", type=input.float)
RSI_VWMA_overbought = input(80, "RSI Overbought Level", type=input.float)
VWMA_length = input(20, "VWMA Length")
// RSI with VWMA as source
RSI_VWMA = rsi(vwma(close, VWMA_length), RSI_length)
// Plotting, overlay=false
r=plot(RSI_VWMA, title="RSI-VWMA", color = RSI_VWMA > RSI_VWMA_overbought ? color(#e57373) : RSI_VWMA < RSI_VWMA_oversold ? color(#4db6ac) : color.blue, title="rsi", linewidth=1, style=plot.style_line)
h1=plot(RSI_VWMA_overbought, title="Overbought", color = color.silver, style=plot.style_stepline)
h2=plot(RSI_VWMA_oversold, title="Oversold", color = color.silver, style=plot.style_stepline)
fill(r, h1, color = RSI_VWMA > RSI_VWMA_overbought ? color(#e57373) : na, transp = 60, title="Overbought Fill")
fill(r, h2, color = RSI_VWMA < RSI_VWMA_oversold ? color(#4db6ac) : na, transp = 60, title="Oversold Fill")