Aktualisiert

Daily + Anchored VWAP

862
**Daily VWAP + Anchored VWAP (RTH / Full Session Toggle)**

This script provides a clean and reliable implementation of Daily VWAP along with an Anchored VWAP, designed to behave consistently across different session types and chart settings.

The Daily VWAP automatically resets each day based on the selected mode. In RTH mode, it resets on the first regular-session bar and only includes regular trading hours. In Full Session mode, it resets on the first bar of the day and includes all available price data. The calculation uses a proper cumulative price × volume divided by volume approach, ensuring accuracy with no gaps or delayed starts on the opening candle.

The script includes a historical display control that allows switching between showing only the current trading day or displaying a configurable number of previous trading days. The “today only” mode is handled using chart-based date detection, which avoids the common issues seen in other VWAP scripts where the first bars of the session are incorrectly excluded.

An Anchored VWAP is also included, which starts from the first session bar of a user-defined number of trading days back and accumulates forward to the present. This anchored VWAP operates independently from the daily VWAP visibility settings and remains stable regardless of whether historical display is enabled or not.

A session toggle allows switching between RTH-only behavior and full-session behavior. This setting applies consistently to both the Daily VWAP and Anchored VWAP, making it easy to compare how price interacts with VWAP under different session definitions.

This script is designed to avoid common VWAP issues such as incorrect start points, broken “today only” filtering, and inconsistent handling of extended hours. The logic separates reset conditions, accumulation, and display filtering to ensure stable and predictable output.

This tool is useful for intraday trading, tracking institutional positioning, anchoring VWAP to recent sessions, and analyzing price behavior across different session types.

Anchored VWAP requires sufficient historical data on the chart to include the selected anchor start point. Behavior may vary slightly depending on the symbol’s session definition and chart settings.

Built for precision and reliability, with a focus on correct behavior in real trading conditions.
Versionshinweise
Updated to work properly when extended hours is selected.
Versionshinweise
Internal updates.
Versionshinweise
Pine category updated.
Versionshinweise
Added Standard Deviation bands with user controls.
Versionshinweise
**What the update does**

The indicator previously had a simple on/off switch called "Use RTH Only." When switched on, it restricted all of its VWAP math to the regular trading session as defined by the exchange. When switched off, it used every bar of the day around the clock. The switch offered no control over *which* hours counted — it only accepted or rejected the exchange's fixed definition of regular hours.

The update replaces that rigid switch with a flexible time window that can be set by hand.

**The new control**

- **A start-and-end time field.** Instead of relying on the exchange's built-in idea of "regular hours," there is now a field where any opening time and closing time can be entered directly. The default is set to a standard stock-market session, but it can be changed to whatever window is wanted.
- **A companion on/off switch.** A toggle sits alongside the time field. When it is on, only the chosen window feeds the calculations. When it is off, the indicator behaves as it did before in its "everything" mode, using the full day and resetting at the calendar day boundary. This preserves the old all-hours behavior so nothing was lost.

**Why this matters**

- **Custom hours, not fixed hours.** The old design was locked to whatever the exchange labeled as regular trading. The new design lets the session be defined freely, so it can match a shorter window, a longer window, an overnight window, or any other stretch of the day.
- **The calculations respect the chosen window.** Everything the indicator measures — the volume-weighted average price and its surrounding statistical bands — now counts only the bars inside the selected time frame when the toggle is on. Bars outside that window are simply ignored.
- **The daily reset follows the window.** Each day, the running calculation now begins fresh at the moment the chosen window opens, rather than at the exchange's regular-session open or the calendar day rollover. This keeps each day's reading self-contained within the hours that were selected.

**One behavior worth flagging**

- **The anchored line also follows the window.** The indicator has a second, separately anchored average that reaches back a set number of days. Because it shares the same reset logic, turning the custom window on will make that anchored line begin at the opening of the chosen window on its starting day, rather than at the calendar-day start. The behavior stays consistent, but the starting point shifts to match the selected hours.

**Net effect**

The change trades a one-size-fits-all switch for a precise, adjustable time window while keeping the original full-day mode available as a fallback. It adds control without removing anything that was there before.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.