OPEN-SOURCE SCRIPT
Updated 4-Year Cycles [jpkxyz]

Overview of the Script
I wanted to write a script that encompasses the wide-spread macro fund manager investment thesis:
Cycle Theory Background:
The 2007-2008 financial crisis transformed central bank monetary policy by introducing:
- Quantitative Easing (QE): Creating money to buy assets and inject liquidity
- Coordinated global monetary interventions
Proactive 4-year economic cycles characterised by:
- Expansionary periods (low rates, money creation)
- Followed by contraction/normalisation
Central banks now deliberately manipulate liquidity, interest rates, and asset prices to control economic cycles, using monetary policy as a precision tool rather than a blunt instrument.
Cycle Characteristics (based on historical cycles):
- A cycle has 4 seasons (Spring, Summer, Fall, Winter)
- Each season with a cycle lasts 365 days
- The Cycle Low happens towards the beginning of the Spring Season of each new cycle
- This is followed by a run up throughout the Spring and Summer Season
- The Cycle High happens towards the end of the Fall Season
- The Winter season is characterised by price corrections until establishing a new floor in the Spring of the next cycle
Key Functionalities
1. Cycle Tracking
- Divides market history into 4-year cycles (Spring, Summer, Fall, Winter)
- Starts tracking cycles from 2011 (first cycle after the 2007 crisis cycle)
- Identifies and marks cycle boundaries
2. Visualization
- Colors background based on current cycle season
- Draws lines connecting:
- Cycle highs and lows
- Inter-cycle price movements
- Adds labels showing:
- Percentage gains/losses between cycles
- Number of days between significant points
3. Customization Options
- Allows users to customize:
- Colors for each season
- Line and label colors
- Label size
- Background opacity
Detailed Mechanism
Cycle Identification
- Uses a modulo calculation to determine the current season in the 4-year cycle
- Preset boundary years include 2015, 2019, 2023, 2027
- Automatically tracks and marks cycle transitions
Price Analysis
- Tracks highest and lowest prices within each cycle
- Calculates percentage changes:
- Intra-cycle (low to high)
- Inter-cycle (previous high to current high/low)
Visualization Techniques
- Background color changes based on current cycle season
- Dashed and solid lines connect significant price points
- Labels provide quantitative insights about price movements
Unique Aspects
1. Predictive Cycle Framework: Provides a structured way to view market movements beyond traditional technical analysis
2. Seasonal Color Coding: Intuitive visual representation of market cycle stages
3. Comprehensive Price Tracking: Captures both intra-cycle and inter-cycle price dynamics
4. Highly Customizable: Users can adjust visual parameters to suit their preferences
Potential Use Cases
- Technical analysis for long-term investors
- Identifying market cycle patterns
- Understanding historical price movement rhythms
- Educational tool for market cycle theory
Limitations/Considerations
- Based on a predefined 4-year cycle model (Liquidity Cycles)
- Historic Cycle Structures are not an indication for future performance
- May not perfectly represent all market behavior
- Requires visual interpretation
This script is particularly interesting for investors who believe in cyclical market theories and want a visual, data-driven representation of market stages.
I wanted to write a script that encompasses the wide-spread macro fund manager investment thesis:
"Crypto is simply and expression of macro."A thesis pioneered by the likes of Raoul Pal (EXPAAM), Andreesen Horowitz (A16Z), Joe McCann (ASYMETRIC), Bob Loukas and many more.
Cycle Theory Background:
The 2007-2008 financial crisis transformed central bank monetary policy by introducing:
- Quantitative Easing (QE): Creating money to buy assets and inject liquidity
- Coordinated global monetary interventions
Proactive 4-year economic cycles characterised by:
- Expansionary periods (low rates, money creation)
- Followed by contraction/normalisation
Central banks now deliberately manipulate liquidity, interest rates, and asset prices to control economic cycles, using monetary policy as a precision tool rather than a blunt instrument.
Cycle Characteristics (based on historical cycles):
- A cycle has 4 seasons (Spring, Summer, Fall, Winter)
- Each season with a cycle lasts 365 days
- The Cycle Low happens towards the beginning of the Spring Season of each new cycle
- This is followed by a run up throughout the Spring and Summer Season
- The Cycle High happens towards the end of the Fall Season
- The Winter season is characterised by price corrections until establishing a new floor in the Spring of the next cycle
Key Functionalities
1. Cycle Tracking
- Divides market history into 4-year cycles (Spring, Summer, Fall, Winter)
- Starts tracking cycles from 2011 (first cycle after the 2007 crisis cycle)
- Identifies and marks cycle boundaries
2. Visualization
- Colors background based on current cycle season
- Draws lines connecting:
- Cycle highs and lows
- Inter-cycle price movements
- Adds labels showing:
- Percentage gains/losses between cycles
- Number of days between significant points
3. Customization Options
- Allows users to customize:
- Colors for each season
- Line and label colors
- Label size
- Background opacity
Detailed Mechanism
Cycle Identification
- Uses a modulo calculation to determine the current season in the 4-year cycle
- Preset boundary years include 2015, 2019, 2023, 2027
- Automatically tracks and marks cycle transitions
Price Analysis
- Tracks highest and lowest prices within each cycle
- Calculates percentage changes:
- Intra-cycle (low to high)
- Inter-cycle (previous high to current high/low)
Visualization Techniques
- Background color changes based on current cycle season
- Dashed and solid lines connect significant price points
- Labels provide quantitative insights about price movements
Unique Aspects
1. Predictive Cycle Framework: Provides a structured way to view market movements beyond traditional technical analysis
2. Seasonal Color Coding: Intuitive visual representation of market cycle stages
3. Comprehensive Price Tracking: Captures both intra-cycle and inter-cycle price dynamics
4. Highly Customizable: Users can adjust visual parameters to suit their preferences
Potential Use Cases
- Technical analysis for long-term investors
- Identifying market cycle patterns
- Understanding historical price movement rhythms
- Educational tool for market cycle theory
Limitations/Considerations
- Based on a predefined 4-year cycle model (Liquidity Cycles)
- Historic Cycle Structures are not an indication for future performance
- May not perfectly represent all market behavior
- Requires visual interpretation
This script is particularly interesting for investors who believe in cyclical market theories and want a visual, data-driven representation of market stages.
Release Notes
Glitch_ BTC 4-Year Cycles — v2.0 Changelog──────────────────────────────────────────
ABOUT
Bitcoin's 4-year cycle is one of the macro patterns in crypto, anchored to the halving schedule (~every 210,000 blocks) and correlating to the business cycle. This indicator models the cycle as four seasonal phases — Spring, Summer, Fall, Winter — with Spring beginning the year before each halving.
Bitcoin was officially launched on January 3, 2009 by Satoshi Nakamoto, who mined the genesis block. The cycle math is anchored to 2011, the first year of meaningful exchange trading.
This is a BTC-specific indicator. Use it on any BTC pair — the cycle boundaries are calculated mathematically and work regardless of how far back your chart's price history goes.
──────────────────────────────────────────
WHAT'S NEW IN v2.0
Multi-Timeframe Support
• Now works on Daily, Weekly, and Monthly charts (previously limited to 1D–5D).
• Cycle boundaries are detected using a timeframe-agnostic year-transition method — no hardcoded dates, so boundaries land on the correct bar regardless of timeframe.
Scalable Cycle Detection
• Removed the hardcoded boundary year array. Cycle boundaries are now derived from a single anchor year (2011) using modulo arithmetic: (year − 2011) % 4 == 0.
• Works indefinitely into the future — no manual updates needed for 2027, 2031, and beyond.
Year Separator Lines
• Added thin dotted lines at each yearly boundary to visually differentiate the four seasons within each cycle.
• Fully configurable: toggle on/off and customise the colour via inputs.
Label Styling Refresh
• Labels now use a semi-transparent white background with solid black text for better readability across both light and dark chart themes.
• Label size defaults to "small" for cleaner presentation on higher timeframes.
Bug Fixes
• Fixed: Monthly timeframe was incorrectly rejected due to an unreliable seconds-based check. Now uses PineScript's native timeframe.ismonthly for accurate detection.
• Fixed: Cycle boundary vertical lines were missing on Weekly/Monthly charts because the original logic required an exact Jan 1 date match, which higher-timeframe bars don't hit. Replaced with year-transition detection.
• Fixed: First cycle was silently skipped when chart data started in a cycle boundary year (e.g. 2011). Added first-bar initialisation to properly capture the opening cycle.
──────────────────────────────────────────
HOW IT WORKS
The indicator draws:
• Seasonal background shading (Spring, Summer, Fall, Winter) across the full chart.
• Vertical cycle boundary lines every 4 years marking Winter → Spring transitions.
• Intra-cycle connections (dashed) linking each cycle's low to its high, with percentage gain labels.
• Inter-cycle connections (solid) linking highs-to-highs and lows-to-lows across cycles, with percentage change and day count labels.
• Inter-cycle drawdown lines (dashed) from each cycle's high to the next cycle's low, with loss percentage labels.
──────────────────────────────────────────
SETTINGS
• Season colours (Spring, Summer, Fall, Winter) — fully customisable
• Cycle boundary line colour and width
• Year separator lines — toggle and colour
• Label background, text colour, and size
• Background opacity
──────────────────────────────────────────
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.