Pi Cycle Top OscillatorOverview
The Pi Cycle Top Oscillator is an advanced, adaptive iteration of the classic Pi Cycle Top indicator, reimagined as a continuous risk metric. While the original indicator famously predicted Bitcoin’s macro peaks by waiting for a binary crossover of the 111-day SMA and the 2x 350-day SMA, this script translates the relationship between these two moving averages into a normalized 0 to 1 oscillator, providing both buy and sell signals.
As an asset matures, its volatility historically compresses. In the 2021 cycle, the classic moving averages barely touched, meaning future cycles might never see a pure crossover due to the law of diminishing returns. This oscillator solves that problem by replacing the rigid crossover requirement with dynamic, regression-based boundaries.
Tip
Hide the Bitcoin price chart to clearly view the metric in the main chart pane:
How it Works
Instead of waiting for a binary signal, this indicator calculates the exact mathematical ratio between the two moving averages:
ratio = ta.sma(close, 111) / (ta.sma(close, 350) * 2)
Using historical extremes of this ratio, the script projects two dynamic boundaries:
Top Boundary: A logarithmic regression curve that accounts for historical volatility decay, descending over time.
Bottom Boundary: A linear regression line representing macro bottoms.
The current ratio is then normalized between these two converging lines, producing a continuous Risk metric.
Key Features
Continuous Risk Scale: Unlike the classic indicator which is either "on" or "off", this oscillator provides a constant reading from 0 (historical bottom) to 1 (probable macro top).
Volatility Adjusted: The logarithmic top line factors in macro volatility decay, ensuring the indicator remains relevant in future cycles even if a classic crossover never occurs.
Visual Chart Feedback: The main chart automatically highlights price bars in Green when Risk falls below your custom Buy Zone Level, and Red when Risk exceeds your Sell Zone Level.
Dual Display Modes: Use the indicator settings to toggle between the normalized 0-1 "Oscillator" view and the raw "Fit Lines" view to see the actual ratio and regression curves.
How to Use
This tool is designed for macro-level portfolio risk management rather than short-term trading.
Accumulation: Readings near or below 0.1 historically correlate with macro bottoms, presenting potential long-term accumulation zones.
Distribution: Readings near or above 0.9 indicate severe market overheating, signaling potential distribution zones.
You can adjust the Buy and Sell zone thresholds in the indicator settings to fit your personal risk tolerance.
Limitations
Bitcoin Exclusive: This indicator is designed strictly for analyzing Bitcoin. Its mathematical model is based entirely on Bitcoin's historical macro cycles and is not applicable to other cryptocurrencies or traditional assets.
No Guaranteed Extremes: There are no guarantees that the oscillator will reach the upper or lower boundaries in future cycles, nor that it will remain strictly within the 0 to 1 range. For example, during the 2025 cycle, the oscillator never reached the theoretical sell zone, demonstrating that market dynamics can and do shift.
Static Curve Fitting: The regression curves for the upper and lower boundaries were fitted using the global tops and bottoms of the 111-day and 2x 350-day SMA ratio prior to 2023. The resulting equation coefficients are hardcoded directly into the script. As new macro extremes form in the future, these boundary models may eventually require a new approximation to maintain their accuracy.
Chỉ báo Pine Script®






















