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提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。