Volume Strength Finder
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Saravanan_Ragavan

//@version=4
study("Volume Strength Finder", "VSF", overlay=true)

T1 = time(timeframe.period, "0915-0916")
T2 = time(timeframe.period, "0915-1530")
Y = bar_index
Z1 = valuewhen(T1, bar_index, 0)
L = Y-Z1 + 1



SSPV = 0.00
SSNV = 0.00
pdw=0.00
ndw=0.00
total_w=0.00
for i = 1 to L-1
    total_w:=high[i]-low[i]
    positive = close[i]-low[i]
    negative = high[i]- close[i]
    pdw := (positive/total_w)*100
    ndw := (negative/total_w)*100
    
    
    SSPV := (volume[i]*pdw)/100 + SSPV
    
    SSNV := (volume[i]*ndw)/100 + SSNV
    



total_v = SSPV +SSNV
Pos = (SSPV / total_v) *100
Neg = (SSNV / total_v) *100

bgc = SSPV>SSNV ? color.green: SSPV<SSNV ? color.red: color.white
barcolor (bgc)




var table sDisplay = table.new(position.top_right, 1, 5, bgcolor = color.aqua, frame_width = 2, frame_color = color.black)

if barstate.islast
    table.cell(sDisplay, 0, 0, "Today's Volume : " + tostring(total_v), text_color = color.white, text_size=size.large, bgcolor=color.aqua)
    table.cell(sDisplay, 0, 1, "Buyers Volume: " +tostring(round(SSPV)) , text_color = color.white, text_size=size.large, bgcolor=color.green)
    table.cell(sDisplay, 0, 2, "Sellers Volume: " +tostring(round(SSNV)) , text_color = color.white, text_size=size.large, bgcolor=color.red)
	table.cell(sDisplay, 0, 3, "Buyers Strength: " +tostring(round(Pos)) + "%" , text_color = color.white, text_size=size.large, bgcolor=color.green)
	table.cell(sDisplay, 0, 4, "Sellers Strength: " +tostring(round(Neg)) + "%" , text_color = color.white, text_size=size.large, bgcolor=color.red)
    
    