TradingView

Rolling VWAP

TradingView Telah dikemas kini   
█  OVERVIEW


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.



█  CONCEPTS


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.



█  HOW TO USE IT


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.



█  NOTES


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.

Nota Keluaran:
v2
Updated to include standard deviation bands adjustable from the input menu.
Nota Keluaran:
v3

Updated to include 2 more sets of standard deviation bands.

Get $15 worth of TradingView Coins for you and a friend: www.tradingview.com/share-your-love/

Read more about the new tools and features we're building for you: www.tradingview.com/blog/en/
Skrip sumber terbuka

Dalam semangat TradingView yang sebenar, penulis skrip ini telah menerbitkannya dengan menggunakan sumber terbuka supaya pedagang-pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda dapat menggunakannya secara percuma tetapi penggunaan semula kod ini dalam penerbitan adalah dikawalselia oleh Peraturan Dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.

Ingin menggunakan skrip ini pada carta?