OPEN-SOURCE SCRIPT

VWAP slope (normalized)

929
**Normalized VWAP Slope (Session-Based Regime Filter)**

This indicator measures the slope of the session VWAP using a linear regression model and normalizes it by ATR. The goal is to identify whether the market is in a **balanced (range) state** or in a **directional (trend / discovery) state**.

The script calculates the slope of the VWAP regression line over a configurable lookback period and divides it by the current ATR value. This normalization makes the slope comparable across different instruments and volatility environments.

To avoid unstable readings at the start of a session, the indicator includes a **warm-up filter** that ignores the first N bars after the daily session reset.

**How it works**

1. Session VWAP is calculated using TradingView's built-in VWAP function.
2. A linear regression is applied to the VWAP over the selected lookback length.
3. The difference between consecutive regression values produces the VWAP slope.
4. The slope is normalized by ATR to account for changing volatility.
5. During the warm-up period after the session reset, values are suppressed to prevent distortions caused by the VWAP initialization.

**Interpretation**

The normalized slope represents how steep the VWAP is relative to normal market volatility.

Typical interpretation:

* Values near **0** → VWAP is flat → market is likely in **balance / range**
* Moderate positive or negative values → **developing directional bias**
* Large absolute values → **strong directional move / information driven market**

**Typical threshold usage**

Many mean-reversion strategies use thresholds to determine when range trading is allowed.

Example guideline:

For Intraday Session

* `|slope| < 0.01`and |slope| > -0.01 → Balanced market
* `|slope| > 0.01`or |slope| < -0.01 → Directional market (range trading discouraged)

These thresholds should be adjusted depending on the instrument and timeframe.

**Inputs**


* **LinReg Length** – Lookback period used for the VWAP regression slope.
* **Warm-up Bars** – Number of bars ignored after a new session begins.
* **ATR Length** – Period used for volatility normalization.
* **Upper / Lower Threshold** – Reference levels used to identify balanced vs directional conditions.

**Purpose**

This tool is designed primarily as a **market regime filter**, especially useful for strategies that rely on mean reversion around VWAP. By detecting when the VWAP becomes steep relative to normal volatility, traders can avoid applying range strategies during strong directional moves.

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.