VWAP Indicator with Period
translated from https://www.tradingview.com/script/rSTNnV6B-VWAP-with-period/
//VWAP
// There are five steps in calculating VWAP:
//
// 1. Calculate the Typical Price for the period. [(High + Low + Close)/3)]
// 2. Multiply the Typical Price by the period Volume (Typical Price x Volume)
// 3. Create a Cumulative Total of Typical Price. Cumulative(Typical Price x Volume)
// 4. Create a Cumulative Total of Volume. Cumulative(Volume)
// 5. Divide the Cumulative Totals.
//
// VWAP = Cumulative(Typical Price x Volume) / Cumulative(Volume)
//Period = 14
set tPrice = (high + low + close) / 3
set tPriceVolume = tPrice * volume
//cumulative sum with period 14
set ctPriceVolume = sum(tPriceVolume , 14)
set cVolume = sum(volume, 14)
set vwap = ctPriceVolume / cVolume
plot(vwap , line, any, main)
