OPEN-SOURCE SCRIPT
AVWAP TF_ATR

Advanced Multi-Source AVWAP with ATR Filters
This indicator is a versatile tool designed to calculate the Anchored Volume Weighted Average Price (AVWAP) from four different dynamic and manual sources. Unlike traditional AVWAPs that require manual repositioning, this script uses ATR-based volatility filters to automatically detect significant price pivots and volume spikes.
Key Features
1. Automated Swing High & Low Anchoring
The indicator scans the last N bars to find the highest and lowest points. To prevent "fake" pivots, it uses an ATR Filter Multiplier.
How it works: A new anchor is only set if the new high/low exceeds the previous one by a specific multiple of the Average True Range (ATR). This ensures that the AVWAP starts from a statistically significant trend reversal point.
2. Volume Spike Detection
Automatically starts a new AVWAP calculation when a massive influx of volume occurs.
Logic: It identifies bars where volume is significantly higher than the 20-period average AND the price range (High-Low) is wider than the ATR. This helps track the "average cost" of the institutional move that caused the breakout.
3. Manual Date Anchor
For traders who want to track the volume-weighted average from a specific event (Earnings, FOMC, Yearly Open), a manual date/time input is available.
4. Multi-Timeframe (MTF) Support
You can calculate AVWAP based on a higher timeframe (e.g., Daily AVWAP displayed on a 15m chart) while maintaining calculation precision.
Input Settings & Tooltips
AVWAP Timeframe: Set the calculation period. Tip: Should be equal to or higher than your chart timeframe.
ATR Period: Defines the lookback for volatility calculation (Default: 14).
Peak/Bottom ATR Filter: Increases the requirement for a new pivot. Higher values result in more stable, long-term AVWAP lines.
Volume Multiplier: Defines what constitutes a "spike" (e.g., 2.0x the average volume).
How to Trade with this Indicator
Dynamic Support/Resistance: The Swing Low AVWAP often acts as a strong support in an uptrend, while the Swing High AVWAP acts as resistance in a downtrend.
Trend Confirmation: If the price is trading above all three AVWAPs (Swing High, Low, and Date), the sentiment is strongly bullish.
Mean Reversion: Large deviations from the Volume Spike AVWAP often lead to a "snap-back" to the mean.
Alerts: The script includes built-in alerts for price crossings. You can set a single alert for "Any alert() function call" to be notified of any AVWAP breach.
Technical Details
Language: Pine Script v5
Overlay: Yes
Alerts: Dynamic crossing alerts for all active lines.
This indicator is a versatile tool designed to calculate the Anchored Volume Weighted Average Price (AVWAP) from four different dynamic and manual sources. Unlike traditional AVWAPs that require manual repositioning, this script uses ATR-based volatility filters to automatically detect significant price pivots and volume spikes.
Key Features
1. Automated Swing High & Low Anchoring
The indicator scans the last N bars to find the highest and lowest points. To prevent "fake" pivots, it uses an ATR Filter Multiplier.
How it works: A new anchor is only set if the new high/low exceeds the previous one by a specific multiple of the Average True Range (ATR). This ensures that the AVWAP starts from a statistically significant trend reversal point.
2. Volume Spike Detection
Automatically starts a new AVWAP calculation when a massive influx of volume occurs.
Logic: It identifies bars where volume is significantly higher than the 20-period average AND the price range (High-Low) is wider than the ATR. This helps track the "average cost" of the institutional move that caused the breakout.
3. Manual Date Anchor
For traders who want to track the volume-weighted average from a specific event (Earnings, FOMC, Yearly Open), a manual date/time input is available.
4. Multi-Timeframe (MTF) Support
You can calculate AVWAP based on a higher timeframe (e.g., Daily AVWAP displayed on a 15m chart) while maintaining calculation precision.
Input Settings & Tooltips
AVWAP Timeframe: Set the calculation period. Tip: Should be equal to or higher than your chart timeframe.
ATR Period: Defines the lookback for volatility calculation (Default: 14).
Peak/Bottom ATR Filter: Increases the requirement for a new pivot. Higher values result in more stable, long-term AVWAP lines.
Volume Multiplier: Defines what constitutes a "spike" (e.g., 2.0x the average volume).
How to Trade with this Indicator
Dynamic Support/Resistance: The Swing Low AVWAP often acts as a strong support in an uptrend, while the Swing High AVWAP acts as resistance in a downtrend.
Trend Confirmation: If the price is trading above all three AVWAPs (Swing High, Low, and Date), the sentiment is strongly bullish.
Mean Reversion: Large deviations from the Volume Spike AVWAP often lead to a "snap-back" to the mean.
Alerts: The script includes built-in alerts for price crossings. You can set a single alert for "Any alert() function call" to be notified of any AVWAP breach.
Technical Details
Language: Pine Script v5
Overlay: Yes
Alerts: Dynamic crossing alerts for all active lines.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.