The Volume Weighted Average Price (VWAP) is a widely used technical analysis indicator that reflects the volume-weighted average price over a period of time. It is especially useful for traders because it provides a reference of fair value for an asset by taking into account both price and volume of transactions.
The Rolling VWAP, or dynamic VWAP, is a variant of the traditional VWAP that calculates the volume-weighted average price continuously over a defined number of bars. Instead of resetting at the beginning of each day, like a typical VWAP, the Rolling VWAP continuously recalculates over the most recent bars, allowing for a continuous and adaptive tracking of the asset’s value.
This article explores how the Rolling VWAP works, its key components, and how it can be used to improve precision in trading decisions.
The Rolling VWAP combines the price and volume of recent bars to offer a dynamically adjusting volume-weighted average. By updating continuously, it provides a real-time view of the weighted average price, making it a useful tool for identifying trends as well as short-term support and resistance zones.
Additionally, the Rolling VWAP can be accompanied by standard deviation bands that help identify overbought and oversold zones. These bands provide a visual indication of where the price has moved away from its weighted average value, allowing traders to anticipate potential reversals or trend continuations.
src): This is the price value used for the indicator’s calculations. By default, it uses the custom close price (customclose), but it can be adjusted depending on the trader’s needs.minBarsInput): This parameter defines the minimum number of bars to calculate the VWAP. The higher the number of bars, the more stable the Rolling VWAP value will be.stdevMult1, stdevMult2, stdevMult3): These multipliers are used to define the standard deviation bands around the VWAP, helping traders identify potential support and resistance levels.showbands): An optional parameter to toggle the visibility of the standard deviation bands.The Rolling VWAP can be configured according to the trader’s needs, adjusting several parameters to suit different trading styles or timeframes. The most important configurable parameters are:
The data source (src) is the price used to calculate the VWAP. Normally, the closing price is used, but it can be adjusted to other values such as the opening price, high, or low of each bar.
The minBarsInput parameter sets the minimum number of bars used to calculate the VWAP. A typical value might be 10, but it can be adjusted depending on the timeframe and market type. This value ensures that the calculation is stable enough to avoid excessive fluctuations in volatile markets.
The Rolling VWAP includes three standard deviation bands adjustable through the multipliers:
The indicator also includes the option to toggle the visibility of the standard deviation bands. This is useful when traders prefer a cleaner chart or only need the VWAP calculation without additional visual references.
The Rolling VWAP calculation follows a dynamic structure, adapting to the timeframe being used. The number of bars used to calculate the VWAP adjusts depending on the current timeframe of the chart. Here’s how the calculation behaves across different timeframes:
minBarsInput parameter.This dynamic adjustment ensures that the VWAP remains relevant and effective across different market conditions and timeframes.
The Rolling VWAP is calculated as the sum of the price multiplied by the volume, divided by the total volume of the selected bars. The formula is:
RollingVWAP=∑(Price×Volume)/∑Volume
The standard deviation of the volume-weighted price is then calculated to generate the upper and lower bands, providing a measure of market volatility.
The bands that accompany the Rolling VWAP offer valuable visual references for traders. These bands are calculated using the standard deviation of prices relative to the VWAP and are multiplied by adjustable values to define levels of price deviation from the weighted average.
The bands can be interpreted as follows:
By including three levels of bands with different standard deviation multipliers, the indicator allows traders to identify both short-term reversals and extreme price movements that may indicate the end of a trend.
The Rolling VWAP is a powerful tool for traders who want an adaptable indicator that not only provides a volume-weighted average price but also dynamic support and resistance levels through its standard deviation bands. Its ability to adjust to different timeframes and its versatility make it useful for both intraday trading and longer-term analysis.
This indicator can be an excellent addition to any trader’s toolkit, improving precision in identifying entry and exit points, as well as assessing the strength of a trend.
//PRC Rolling VWAP
//version = 0
//06.03.24
//Iván González @ www.prorealcode.com
//Sharing ProRealTime knowledge
///inputs
src = customclose
minBarsInput = 10
stdevMult1 = 1
stdevMult2 = 1.5
stdevMult3 = 2.5
showbands = 1
//////BARS TO CALCULATE VWAP/////////
if gettimeframe < 86400 then
bars = minbarsinput
elsif gettimeframe >= 86400 and gettimeframe < 604800 then
bars = MAX(22,minbarsinput)
elsif gettimeframe = 604800 then
bars = MAX(round(90/5),minbarsinput)
else
bars = MAX(round(252/22),minbarsinput)
endif
//////////////////////////////////////
sumSrcVol = summation[bars](src*volume)
sumVol = summation[bars](volume)
sumSrcSrcVol = summation[bars](pow(src,2)*volume)
rollingvwap = sumSrcVol / SumVol
variance = sumSrcSrcVol / SumVol - pow(rollingvwap,2)
variance = max(0,variance)
stDev = sqrt(variance)
if showbands then
upperband1 = rollingVwap + stDev*stdevMult1
lowerband1 = rollingVwap - stDev*stdevMult1
upperband2 = rollingVwap + stDev*stdevMult2
lowerband2 = rollingVwap - stDev*stdevMult2
upperband3 = rollingVwap + stDev*stdevMult3
lowerband3 = rollingVwap - stDev*stdevMult3
else
upperband1 = undefined
lowerband1 = undefined
upperband2 = undefined
lowerband2 = undefined
upperband3 = undefined
lowerband3 = undefined
endif
return rollingvwap as "rollingVwap" coloured("orange"),upperband1 as "upperband1"coloured("red"),lowerband1 as "lowerband1"coloured("red"),upperband2 as "upperband2"coloured("yellow"),lowerband2 as "lowerband2"coloured("yellow"),upperband3 as "upperband3"coloured("green"),lowerband3 as "lowerband3"coloured("green")