PROTECTED SOURCE SCRIPT

Seasonality

41
Seasonality Analysis

This script is a technical tool designed to identify and project historical price cycles onto the current chart. It calculates the average price movement for specific time intervals (days, weeks, or months) over a multi-year lookback period to highlight recurring seasonal patterns.

Technical Features

Historical Averaging: Aggregates price deltas ($Close - Close[1]$) for each calendar "slot" (e.g., Trading Day 1–252) over a user-defined period (up to 30 years).
Multi-Timeframe Support: Automatically adapts to Daily (252 days), Weekly (52 weeks), or Monthly (12 months) intervals.
De-trending: Removes long-term linear bias from the data to isolate pure seasonal oscillations, ensuring the curve reflects cyclicality rather than just long-term trend.
Dynamic Scaling: Automatically scales the seasonal curve to match the price range of the currently visible bars for better visual alignment.
Future Projection: Plots the historical seasonal expectation into the future (the "empty" space to the right) to assist in cyclical forecasting.

Key Inputs

Lookback Period: Number of years included in the statistical average.
Smoothing (MA): Optional moving average applied to the seasonal curve to filter out noise.
Trading Days: Toggle between fixed (252) or variable calculation (useful for 24/7 or OTC markets).


Disclaimer: Past performance is not indicative of future results. Seasonality represents a statistical average of historical data and should not be used as a standalone signal for trading. Market conditions change, and historical cycles may fail to repeat due to fundamental shifts, black swan events, or changing market regimes. Use this tool only as a secondary filter within a comprehensive risk management strategy.

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.