study(title = "Inverse Fisher WMA Vortex and RSI", shorttitle="IF_WMA_VI_RSI")
//Inputs
VI_pm = input(5, title="VI Period",minval=2)
VI_ps = input(2, title="VI Smoothing Period",minval=0)
RSI_pm = input(5, title="RSI Main Period",minval=2)
RSI_ps = input(1, title="RSI Smooth Period",minval=0)
//Functions
IF(input)=>(exp(2*input)-1)/(exp(2*input)+1)
//RSI Calculation
raw_RSI=0.1*(rsi(close,RSI_pm)-50)
wma_RSI=wma(raw_RSI,RSI_ps)*100
IF_RSI = IF(wma_RSI)
//Calculate Vortex
VMP = sum( abs( high - low[1]), VI_pm )
VMM = sum( abs( low - high[1]), VI_pm )
STR = sum( atr(1), VI_pm )
VIP = VMP / STR
VIM = VMM / STR
//Apply WMA
wmaVIP = (wma(VIP-1,VI_ps))*10
wmaVIM = (wma(VIM-1,VI_ps))*10
roc_VIP =(wmaVIP - wmaVIP[VI_ps]) / VI_ps
roc_VIM = (wmaVIM - wmaVIM[VI_ps]) / VI_ps
plot(roc_VIP/2, color=iff(roc_VIP>roc_VIM,lime,gray), linewidth=2)
plot(roc_VIM/2, color=iff(roc_VIM>roc_VIP,red,gray), linewidth=2)
plot(IF_RSI,color=iff(IF_RSI>0.8,lime,iff(IF_RSI<-0.8,red,gray)),linewidth=3)
hline(0) |