OPEN-SOURCE SCRIPT
Reverse AVWAP: Institutional Anchor Discovery

Stop guessing your anchors. Let the algorithm find them for you.
Most traders use the Anchored VWAP (AVWAP) the same way: they pick an obvious swing high, swing low, or earnings gap, anchor a line to it, and wait to see if price reacts. But what if we flipped the script? What if we took a significant current price level and mathematically scanned history to find exactly which hidden dates are defending it?
Introducing the Reverse AVWAP.
This indicator acts as an investigative tool for market structure and volume memory. By targeting a specific date or your current real-time chart bar, the script calculates backward, scanning thousands of bars to find the exact historical anchor points where an AVWAP drawn from them converges perfectly with your target price.
How It Works
Instead of projecting forward, this script reverse-engineers the volume profile:
Dynamic Target Selection: Choose to run the calculation from a fixed Target Date or toggle Use Last Chart Bar as Target to dynamically track live, real-time convergence on your current candle.
Historical Matrix Scan: The algorithm searches back in time, calculating the exact AVWAP from every single historical bar up to your target.
Threshold Matching: If a historical AVWAP lands within your custom proximity threshold (e.g., ±2.5% or ±3.5%) of the target price, it flags that date as a valid "Anchor."
Stitched Curve Generation: It draws the historical VWAP curves connecting those hidden anchors directly to your target.
Key Features
Macro First vs. Micro First Scanning: Choose your search direction. Macro First scans from the oldest historical data forward, prioritizing dominant multi-year structural pivots (like All-Time Highs or major cyclical bottoms). Micro First scans from recent data backward, focusing on short-term accumulation zones.
Smart Anti-Clustering: Includes a "Minimum Bars Between Anchors" filter. If the market forms a major rounded peak or flat consolidation, this prevents the script from grabbing 5 consecutive days on the same structure. It forces the algorithm to find distinct, uniquely significant pivot origins.
Up to 15 Historical Curves: Automatically color-codes and plots multiple unique historical AVWAP curves that converge on your target price.
Precision Divergence Labels: Drops clean visual tags on the discovered anchors, showing you exactly how close the historical AVWAP came to your target price down to the decimal percentage.
Under the Hood (Engine Optimizations)
Calculating thousands of historical AVWAPs iteratively would normally trigger a Pine Script timeout or cause massive lag. This indicator utilizes a heavily optimized architecture to bypass TradingView's native limitations:
O(1) Time Math: It uses rolling arrays to track the cumulative sums of Volume and Price × Volume. By subtracting cumulative historical values from current ones, it solves the AVWAP equations instantly in constant time per bar.
Bulletproof Line-Chain Renderer: TradingView’s standard polyline engine frequently suffers from canvas rendering drops when drawing long curves across thousands of bars. This script implements a custom, lightweight rendering engine that segments standard lines into roughly 80 dynamically downsampled links per anchor. The result is a buttery-smooth curve that never fails to render, no matter how far back the anchor sits.
Memory Management: Includes a dedicated garbage-collection routine that wipes and redraws canvas objects on live ticks, keeping your chart clean, responsive, and completely free of visual flickering.
Usage Tips
The History Loading Shortcut: Pine Script can only analyze data that is actively loaded into your browser session. If you are looking for a macro anchor from years ago, use the TradingView "Go to" shortcut (Alt + G on Windows, Option + G on Mac) and enter a past date. This forces the servers to load the historical bars instantly, allowing the script to find the anchor immediately.
Validation: If you see a breakout, run the Reverse AVWAP. If multiple historical volume anchors perfectly align with your current price, you have high-conviction proof of a major institutional volume node. You can then use those newly discovered anchor dates to project standard AVWAPs forward into the future.
Most traders use the Anchored VWAP (AVWAP) the same way: they pick an obvious swing high, swing low, or earnings gap, anchor a line to it, and wait to see if price reacts. But what if we flipped the script? What if we took a significant current price level and mathematically scanned history to find exactly which hidden dates are defending it?
Introducing the Reverse AVWAP.
This indicator acts as an investigative tool for market structure and volume memory. By targeting a specific date or your current real-time chart bar, the script calculates backward, scanning thousands of bars to find the exact historical anchor points where an AVWAP drawn from them converges perfectly with your target price.
How It Works
Instead of projecting forward, this script reverse-engineers the volume profile:
Dynamic Target Selection: Choose to run the calculation from a fixed Target Date or toggle Use Last Chart Bar as Target to dynamically track live, real-time convergence on your current candle.
Historical Matrix Scan: The algorithm searches back in time, calculating the exact AVWAP from every single historical bar up to your target.
Threshold Matching: If a historical AVWAP lands within your custom proximity threshold (e.g., ±2.5% or ±3.5%) of the target price, it flags that date as a valid "Anchor."
Stitched Curve Generation: It draws the historical VWAP curves connecting those hidden anchors directly to your target.
Key Features
Macro First vs. Micro First Scanning: Choose your search direction. Macro First scans from the oldest historical data forward, prioritizing dominant multi-year structural pivots (like All-Time Highs or major cyclical bottoms). Micro First scans from recent data backward, focusing on short-term accumulation zones.
Smart Anti-Clustering: Includes a "Minimum Bars Between Anchors" filter. If the market forms a major rounded peak or flat consolidation, this prevents the script from grabbing 5 consecutive days on the same structure. It forces the algorithm to find distinct, uniquely significant pivot origins.
Up to 15 Historical Curves: Automatically color-codes and plots multiple unique historical AVWAP curves that converge on your target price.
Precision Divergence Labels: Drops clean visual tags on the discovered anchors, showing you exactly how close the historical AVWAP came to your target price down to the decimal percentage.
Under the Hood (Engine Optimizations)
Calculating thousands of historical AVWAPs iteratively would normally trigger a Pine Script timeout or cause massive lag. This indicator utilizes a heavily optimized architecture to bypass TradingView's native limitations:
O(1) Time Math: It uses rolling arrays to track the cumulative sums of Volume and Price × Volume. By subtracting cumulative historical values from current ones, it solves the AVWAP equations instantly in constant time per bar.
Bulletproof Line-Chain Renderer: TradingView’s standard polyline engine frequently suffers from canvas rendering drops when drawing long curves across thousands of bars. This script implements a custom, lightweight rendering engine that segments standard lines into roughly 80 dynamically downsampled links per anchor. The result is a buttery-smooth curve that never fails to render, no matter how far back the anchor sits.
Memory Management: Includes a dedicated garbage-collection routine that wipes and redraws canvas objects on live ticks, keeping your chart clean, responsive, and completely free of visual flickering.
Usage Tips
The History Loading Shortcut: Pine Script can only analyze data that is actively loaded into your browser session. If you are looking for a macro anchor from years ago, use the TradingView "Go to" shortcut (Alt + G on Windows, Option + G on Mac) and enter a past date. This forces the servers to load the historical bars instantly, allowing the script to find the anchor immediately.
Validation: If you see a breakout, run the Reverse AVWAP. If multiple historical volume anchors perfectly align with your current price, you have high-conviction proof of a major institutional volume node. You can then use those newly discovered anchor dates to project standard AVWAPs forward into the future.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.