OPEN-SOURCE SCRIPT
Pi Cycle BTC Top + Pre-Alert Bands

Pi Cycle BTC Top + Pre-Alert Bands is an advanced implementation of the classic Pi Cycle Top model, designed for Bitcoin cycle analysis on higher timeframes (especially 1D BTCUSD/BTCUSD·INDEX).
The original Pi Cycle Top uses two moving averages:
• 111-day SMA (short MA)
• 350-day SMA ×2 (long MA)
A Pi Top is signaled when the 111 SMA crosses above the 350×2 SMA. Historically, this has occurred near major BTC cycle highs.
This script extends that idea with a 3-step early-warning sequence:
• Pi Green – early compression: short/long MA ratio crosses upward into the green band (convergence from below is required).
• Pi Yellow – mid-cycle warning: only fires if a valid Green has already occurred in the same cycle.
• Pi Cycle Top – final top: the classic Pi Cycle cross, limited to one top signal per cycle. After a top, no new Yellow or Top signals can appear until a new Green event starts the next cycle.
Background shading shows the active phase (Green / Yellow / late-cycle zone), so you can see at a glance where BTC is within its Pi-based macro structure.
All logic is non-repainting: request.security() uses lookahead_off and no future data is accessed.
Typical use
This indicator is intended as a macro-cycle timing and risk-awareness tool, not a stand-alone entry system. Many traders use it to:
• Watch for Pi Green as the start of a potential late-cycle advance.
• Treat Pi Yellow as a rising-risk environment and tighten risk management.
• Use the Pi Cycle Top as a historical high-risk zone where large profit-taking or hedging may be considered.
Always combine this with your own analysis (trend, volume, on-chain, macro) before making decisions.
How to set alerts
Add the indicator to your chart (1D BTCUSD or BTCUSD·INDEX recommended).
Click Alerts → Condition → Pi Cycle BTC Top + Pre-Alert Bands.
Choose one of:
• Pi Cycle – Green Pre-Alert (early convergence)
• Pi Cycle – Yellow Pre-Alert (after Green only)
• Pi Cycle – TOP (Single per Cycle, after Green)
Use “Once per bar close” for higher-timeframe reliability.
Disclaimer
This tool is for educational and analytical purposes only. The Pi Cycle concept is based on historical behavior and does not guarantee future results. This is not financial advice; always do your own research and manage risk appropriately.
The original Pi Cycle Top uses two moving averages:
• 111-day SMA (short MA)
• 350-day SMA ×2 (long MA)
A Pi Top is signaled when the 111 SMA crosses above the 350×2 SMA. Historically, this has occurred near major BTC cycle highs.
This script extends that idea with a 3-step early-warning sequence:
• Pi Green – early compression: short/long MA ratio crosses upward into the green band (convergence from below is required).
• Pi Yellow – mid-cycle warning: only fires if a valid Green has already occurred in the same cycle.
• Pi Cycle Top – final top: the classic Pi Cycle cross, limited to one top signal per cycle. After a top, no new Yellow or Top signals can appear until a new Green event starts the next cycle.
Background shading shows the active phase (Green / Yellow / late-cycle zone), so you can see at a glance where BTC is within its Pi-based macro structure.
All logic is non-repainting: request.security() uses lookahead_off and no future data is accessed.
Typical use
This indicator is intended as a macro-cycle timing and risk-awareness tool, not a stand-alone entry system. Many traders use it to:
• Watch for Pi Green as the start of a potential late-cycle advance.
• Treat Pi Yellow as a rising-risk environment and tighten risk management.
• Use the Pi Cycle Top as a historical high-risk zone where large profit-taking or hedging may be considered.
Always combine this with your own analysis (trend, volume, on-chain, macro) before making decisions.
How to set alerts
Add the indicator to your chart (1D BTCUSD or BTCUSD·INDEX recommended).
Click Alerts → Condition → Pi Cycle BTC Top + Pre-Alert Bands.
Choose one of:
• Pi Cycle – Green Pre-Alert (early convergence)
• Pi Cycle – Yellow Pre-Alert (after Green only)
• Pi Cycle – TOP (Single per Cycle, after Green)
Use “Once per bar close” for higher-timeframe reliability.
Disclaimer
This tool is for educational and analytical purposes only. The Pi Cycle concept is based on historical behavior and does not guarantee future results. This is not financial advice; always do your own research and manage risk appropriately.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội Quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội Quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.