Volume Pressure Indicator
//@version=5
indicator("Volume Pressure Indicator [Pt]", shorttitle = 'VPI[Pt]', timeframe = '', format = format.volume, explicit_plot_zorder = true)

buying = volume * (close - low) / (high - low)
selling = volume * (high - close) / (high - low)
pressure = buying - selling

plot(volume, 'Buying Volume', color=color.green, style = plot.style_columns)
plot(selling, 'Selling Volume', color=color.red, style = plot.style_columns)

length = input.int(50, 'Average period')

sv_avg = ta.sma(selling, length)
bv_avg = ta.sma(buying, length)
pressure_avg = ta.sma(pressure, length)

plot(sv_avg, "Average Selling Volume - Shadow", color=color.rgb(0,0,0,0), linewidth = 3)
plot(sv_avg, "Average Selling Volume", color=color.red, linewidth = 2)
plot(bv_avg, "Average Buying Volume - Shadow", color=color.rgb(0,0,0,0), linewidth = 3)
plot(bv_avg, "Average Buying Volume", color=color.green, linewidth = 2)