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.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。