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


// Volume Price Course Belini - VPCB  
// This indicator is a part of a pack of indicators created by William Belini, that suppose the market move based from volume effects at prices. 
//       !! My theory arguments are these: !! 
// >> The oscillation at prices compared with the volume that make it happen, can describe the market comportment. 
// >> Small oscillation with big volume denotes a stable market, and big oscillation with small volume denote a market course variation. 
// - The first indicator is the Relative Volume Prices Index Belini - RVPI, that denote how volume are impacting prices. Meas the sensibility of prices by volume;
// - The second indicator is The Relative Market Status Belini - RMS, what denote the market feeling cicles; 
// - The third indicator its elaborated to traders, named  Trade Trigger RVPI Belini - TTR, 
//   that show the best moment to start a position trading. Do this based from a normal distribution analysis, 
//   from previous values designed by the Relative Prices Index Belini indicator and its historical impact at the future prices. 

//Ps. These indicators are made based from commodities contracts environment and have adaptative mechanisms from their peculiarities. 
//    To use for other markets could be necessary modifications.

//Note: This site don´t recompense creators to their creations, and don´t promove the individual creativity because don´t permite we promote our work.
//      Even though our creations do money to their users. So, I´m disponibilize 2 of 3 indicators here, to have the third, you need contact whit me. 

//@version=5
indicator(title="Relative Volume Prices Index by @WilliamBelini", shorttitle="RVPI-B", format=format.price, precision=0, timeframe="", timeframe_gaps=true, overlay = false)

vol = volume <= 0 ? 1 : math.pow(volume,1)

/////NEGATIVE AND POSITIVE VOLUME AVERAGE/////
// This component is necessary because the volume are changing by the time, and this variation distorce de indicator. 
// The volume are meas and calculate the average from last periods, to minimize the impact by desviations.
// The average volume is calculating from positive and negative prices variation to capture their peculiarities.

comprimento = 7    // Define the number of past candles from average
fonte = volume
var volp = array.new_float(comprimento,fonte)
if close[0]>=close[1]
    array.push(volp, fonte)
    array.shift(volp)
volpmedio = array.avg(volp)

var voln = array.new_float(comprimento, fonte)
if close[0]<close[1]
    array.push(voln,fonte)
    array.shift(voln)
volnmedio = array.avg(voln)

volmed = (close[0]>=close[1])? volpmedio*1000000 :volnmedio*1000000

////// THE FIRST INDICATOR: Volume Price Force Belini [VPFB]  /////////

FV =((close[0]-close[1])/(close[1]))
FV2 = vol <50 ? 0 : math.pow(FV,2)/vol
FVC = FV<0 ?FV2*-1 : FV2

cor = FV>0 ? color.green : color.red
plot(FVC*volmed, color=cor, style=plot.style_columns, title = "T1")