OPEN-SOURCE SCRIPT
Aggiornato Adaptive Pivot Circles

▶Overview
The Adaptive Pivot Circles is a unique geometric indicator that visualizes dynamic market volatility and potential support/resistance zones. Instead of relying on traditional horizontal lines or linear trends, this script projects historical price and time movements into two-dimensional geometric circles.
By applying a Kalman Filter to the distances between historical pivots, the indicator calculates an adaptive, noise-resistant average radius, providing a highly responsive and visually stunning representation of market cycles.
▶Core Concepts & Mechanics
1. Advanced Pivot Detection with ATR Filtering
The script identifies significant Pivot Highs (PH) and Pivot Lows (PL) across the chart. To eliminate market noise and prevent minor pullbacks from distorting the geometry, a built-in ATR Filter is applied. A pivot is only considered valid if its height/depth exceeds a specified multiple of the Average True Range (ATR).
2. Adaptive Radius via Kalman Filter
Most indicators use Simple Moving Averages (SMA) to calculate historical data, which inherently introduces lag. This indicator utilizes a 1D Kalman Filter to estimate the "true" historical radius—measuring both time (X-axis, bars) and price (Y-axis)—between similar pivots (i.e., PH to PH, and PL to PL).
Process Noise (Q): Controls how quickly the filter adapts to new data.
Measurement Noise (R): Controls how much the filter smooths out sudden spikes.
3. Geometric Projection (The Rolling Circles)
When a new pivot is confirmed, the script projects the anticipated market boundaries. The geometric concept is based on a circle connecting the current pivot to the previous one. If you roll that connecting circle around the current pivot, it creates an outer boundary.
To visualize this, the indicator draws two concentric zones around the newly formed pivot:
Inner Ring: Radius is 2x the Kalman-averaged historical radius.
Outer Ring: Radius is 4x the Kalman-averaged historical radius.
▶Key Features & Settings
Kalman Filter Tuning: Fully adjustable Process Noise (Q) and Measurement Noise (R) allow you to fine-tune the algorithm for different timeframes and assets.
Visual Aesthetics (Polyline Drawing): Built using Pine Script v5's advanced polyline drawing objects, the indicator features smooth curves, customizable fill transparencies, and a beautiful Glow Effect (layering transparent thick lines under crisp main lines).
Performance Optimization: You can adjust the Circle Resolution (number of points) to balance between perfect roundness and script rendering performance.
Historical Cleanup: Automatically cleans up old projections to keep your chart uncluttered. Adjust Max History Circles to determine how many recent cycles remain visible.
▶How to Use
Dynamic Support & Resistance: The circumferences of the projected circles often act as non-linear support and resistance levels. Watch for price action reactions as the market approaches the Inner or Outer Rings.
Volatility Gauge: The size of the circles visually represents the current market volatility and the length of recent price swings.
Confluence: Use these geometric projections in conjunction with your existing strategies (e.g., Fibonacci, Volume Profile) to find high-probability reversal zones where price intersects with the circle boundaries.
Disclaimer: This script is for educational and visual purposes only. Geometric projections are not guarantees of future price action. Always use proper risk management.
The Adaptive Pivot Circles is a unique geometric indicator that visualizes dynamic market volatility and potential support/resistance zones. Instead of relying on traditional horizontal lines or linear trends, this script projects historical price and time movements into two-dimensional geometric circles.
By applying a Kalman Filter to the distances between historical pivots, the indicator calculates an adaptive, noise-resistant average radius, providing a highly responsive and visually stunning representation of market cycles.
▶Core Concepts & Mechanics
1. Advanced Pivot Detection with ATR Filtering
The script identifies significant Pivot Highs (PH) and Pivot Lows (PL) across the chart. To eliminate market noise and prevent minor pullbacks from distorting the geometry, a built-in ATR Filter is applied. A pivot is only considered valid if its height/depth exceeds a specified multiple of the Average True Range (ATR).
2. Adaptive Radius via Kalman Filter
Most indicators use Simple Moving Averages (SMA) to calculate historical data, which inherently introduces lag. This indicator utilizes a 1D Kalman Filter to estimate the "true" historical radius—measuring both time (X-axis, bars) and price (Y-axis)—between similar pivots (i.e., PH to PH, and PL to PL).
Process Noise (Q): Controls how quickly the filter adapts to new data.
Measurement Noise (R): Controls how much the filter smooths out sudden spikes.
3. Geometric Projection (The Rolling Circles)
When a new pivot is confirmed, the script projects the anticipated market boundaries. The geometric concept is based on a circle connecting the current pivot to the previous one. If you roll that connecting circle around the current pivot, it creates an outer boundary.
To visualize this, the indicator draws two concentric zones around the newly formed pivot:
Inner Ring: Radius is 2x the Kalman-averaged historical radius.
Outer Ring: Radius is 4x the Kalman-averaged historical radius.
▶Key Features & Settings
Kalman Filter Tuning: Fully adjustable Process Noise (Q) and Measurement Noise (R) allow you to fine-tune the algorithm for different timeframes and assets.
Visual Aesthetics (Polyline Drawing): Built using Pine Script v5's advanced polyline drawing objects, the indicator features smooth curves, customizable fill transparencies, and a beautiful Glow Effect (layering transparent thick lines under crisp main lines).
Performance Optimization: You can adjust the Circle Resolution (number of points) to balance between perfect roundness and script rendering performance.
Historical Cleanup: Automatically cleans up old projections to keep your chart uncluttered. Adjust Max History Circles to determine how many recent cycles remain visible.
▶How to Use
Dynamic Support & Resistance: The circumferences of the projected circles often act as non-linear support and resistance levels. Watch for price action reactions as the market approaches the Inner or Outer Rings.
Volatility Gauge: The size of the circles visually represents the current market volatility and the length of recent price swings.
Confluence: Use these geometric projections in conjunction with your existing strategies (e.g., Fibonacci, Volume Profile) to find high-probability reversal zones where price intersects with the circle boundaries.
Disclaimer: This script is for educational and visual purposes only. Geometric projections are not guarantees of future price action. Always use proper risk management.
Note di rilascio
You can now specify the circle's radius up to N times its original size.Note di rilascio
Optimized initial settings.Note di rilascio
Fixed the logic to ensure circles are plotted in an alternating fashion between Pivot High and Pivot Low points. Additionally, the radius calculation has been slightly adjusted for better accuracy.Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.