Rolling VWAP

TradingView Updated   

This indicator displays a Rolling Volume-Weighted Average Price. Contrary to VWAP indicators which reset at the beginning of a new time segment, RVWAP calculates using a moving window defined by a time period (not a simple number of bars), so it never resets.


If you are not already familiar with ​VWAP, our Help Center will get you started.

The typical VWAP is designed to be used on intraday charts, as it resets at the beginning of the day. Such VWAPs cannot be used on daily, weekly or monthly charts. Instead, this rolling VWAP uses a time period that automatically adjusts to the chart's timeframe. You can thus use RVWAP on any chart that includes ​volume information in its data feed.

Because RVWAP uses a moving window, it does not exhibit the jumpiness of VWAP plots that reset. You can see the more jagged VWAP on the chart above. We think both can be useful to traders; up to you to decide which flavor works for you.


Load the indicator on an active chart (see the Help Center if you don't know how).

Time period

By default, the script uses an auto-stepping mechanism to adjust the time period of its moving window to the chart's timeframe. The following table shows chart timeframes and the corresponding time period used by the script. When the chart's timeframe is less than or equal to the timeframe in the first column, the second column's time period is used to calculate RVWAP:

  Chart       Time
timeframe    period

   1min   🠆   1H
   5min   🠆   4H
   1H     🠆   1D
   4H     🠆   3D
   12H    🠆   1W
   1D     🠆   1M
   1W     🠆   ​3M

You can use the script's inputs to specify a fixed time period, which you can express in any combination of days, hours and minutes.

By default, the time period currently used is displayed in the lower-right corner of the chart. The script's inputs allow you to hide the display or change its size and location.

Minimum Window Size

This input field determines the minimum number of values to keep in the moving window, even if these values are outside the prescribed time period. This mitigates situations where a large time gap between two bars would cause the time window to be empty, which can occur in non-24x7 markets where large time gaps may separate contiguous chart bars, namely across holidays or trading sessions. For example, if you were using a 1D time period and there is a two-day gap between two bars, then no chart bars would fit in the moving window after the gap. The default value is 10 bars.


If you are interested in VWAP indicators, you may find the VWAP Auto Anchored built-in indicator worth a try.

For Pine Script™ coders

The heart of this script's calculations uses the `totalForTimeWhen()` function from the ConditionalAverages library published by PineCoders. It works by maintaining an array of values included in a time period, but without a for loop requiring a lookback from the current bar, so it is much more efficient.

We write our Pine Script™ code using the recommendations in the User Manual's Style Guide.

Look first. Then leap.

Release Notes:
Updated to include standard deviation bands adjustable from the input menu.
Release Notes:

Updated to include 2 more sets of standard deviation bands.

Get $15 worth of TradingView Coins for you and a friend:

Read more about the new tools and features we're building for you:
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.


The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?