TradingView

Chart VWAP

█  OVERVIEW


This indicator displays a ​Volume-Weighted Average Price anchored to the leftmost visible bar of the chart. It dynamically recalculates when the chart's visible bars change because you scroll or zoom your chart.

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. Our Rolling ​VWAP, instead, resets on a rolling time window. You may also find the VWAP Auto Anchored built-in indicator worth a try.



█  HOW TO USE IT


Load the indicator on an active chart (see the Help Center if you don't know how). By default, it displays the chart's ​VWAP in orange and a simple average of the chart's visible close values in gray. This average can be used as a companion to the ​VWAP, since both are calculated from the same set of bars. The script's settings allow you to hide it.

You may also use the script's settings to enable the display of the chart's OHLC (open, high, low, close) levels and the values of the high and low. These are also calculated from the range of visible bars. You can complement the high and low lines with their price and their distance in percent from the chart's latest visible close. You can use the levels to quickly identify the distances from extreme points in the visible price range, as well as observe the visible chart's beginning and end prices.



█  NOTES FOR Pine Script™ CODERS


This script showcases three novelties:
 • Dynamic recalculation on visible bars
 • The VisibleChart library by PineCoders
 • The new `anchor` parameter of ta.vwap()


Dynamic recalculation on visible bars

This script behaves in a novel way made possible by the recent introduction of two new built-in variables: chart.left_visible_bar_time and chart.right_visible_bar_time, which return the opening time of the leftmost and rightmost visible bars on the chart. These are only two of many new built-ins in the `chart.*` namespace. See this blog post for more information, or look up them up by typing "chart." in the Pine Script™ Reference Manual.

Any script using chart.left_visible_bar_time or chart.right_visible_bar_time acquires a unique property, which triggers its recalculation when traders scroll or zoom their chart, causing the range of visible bars to change. This new capability is what makes it possible for this script to calculate its ​VWAP on the chart's visible bars only, and dynamically recalculate if the user scrolls or zooms their chart.

This script is just a start to the party; endless uses for indicators that redraw on changes to the chart will no doubt emerge through the hands of our community's Pine Script™ programmers.


The VisibleChart library by PineCoders

The newly published VisibleChart library is designed to help programmers benefit from the new capabilities made possible by the fact that Pine Script™ code can now tell when it is executing on visible bars. The library's description, functions and example code will help programmers make the most of the new feature.

This script uses three of the library's functions:
 • `PCvc.vVwap()` calculates a ​VWAP for visible bars.
​​​​ • `PCvc.​avg()` calculates the average of a source value for visible bars only. We use it to calculate the average close (the default source).
 • `PCvc.chartXTimePct(25)` calculates a time value corresponding to 25% of the horizontal distance between visible bars, starting from the left.


The new `anchor` parameter of ta.vwap()

Our script also uses this new `anchor` parameter to reset the ​VWAP at the leftmost visible bar. See how simple the code is for the VisibleChart library's `vVwap()` function.

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

Read more about the new tools and features we're building for you: https://www.tradingview.com/blog/en/
오픈 소스 스크립트

이 스크립트의 오써는 참된 트레이딩뷰의 스피릿으로 이 스크립트를 오픈소스로 퍼블리쉬하여 트레이더들로 하여금 이해 및 검증할 수 있도록 하였습니다. 오써를 응원합니다! 스크립트를 무료로 쓸 수 있지만, 다른 퍼블리케이션에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

차트에 이 스크립트를 사용하시겠습니까?