Relative Volume Force Index
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © wbelini

//@version=5
indicator(title="Relative Volume Force Index", shorttitle="RVFI", format=format.price, precision=1, timeframe="", timeframe_gaps=true)
periodK = input.int(1, title="Short Average", minval=1)
periodD = input.int(10, title="Long Average", minval=1)
VolMax = ta.highest(volume,10)

FV =((close-open)/(close))/volume*VolMax
FVAcu= ta.cum(FV)
FVAcuMed = ta.sma(FVAcu,periodK)
FVAcuMedM = ta.sma(FVAcu, periodD)
DifMedia = (FVAcuMed - FVAcuMedM)*100


cor = FV>0 ? color.green : color.red
cor1 = DifMedia < 0 ? color.red : color.green

//plot(FV, title="RVFI Index", color=cor, style=plot.style_columns)
//plot(FVAcu, title="RVFI Acu")
//plot(FVAcuMed, title="RVFI Acu Average", color=#FF6D00)
//plot(FVAcuMedM, title="RVFI Acu Average Longer", color=color.black)
plot(DifMedia, title="Cross averages RVFI", color=cor1, style=plot.style_area)


//h0 = hline(200, "Upper Band", color=#787B86)
//hline(0, "Middle Band", color=color.new(#787B86, 50))
//h1 = hline(-200, "Lower Band", color=#787B86)
//fill(h0, h1, color=color.rgb(33, 150, 243, 90), title="Background")

