OPEN-SOURCE SCRIPT
Cập nhật SeasonalTrader Pro - Seasonality Companion

Seasonality Companion is a separate panel-based script for analyzing seasonal market structure. It shows whether a market has historically tended to behave positively, negatively, neutrally, or inconsistently around the current calendar date.
The script does not generate entries, exits, price targets, stops, alerts, or strategy orders. Its role is to provide seasonal context and make recurring historical behavior easier to evaluate.
It is intended to complement a separate seasonal zone and quality indicator. Final zone validation, tradeability, and risk assessment remain outside the scope of this companion script.
Core idea
Seasonality is often misread because a rising average curve alone does not tell much about how stable or useful that effect actually is. This script separates several questions:
- What does the average seasonal path of the year look like?
- How far does the current year deviate from that path?
- What happened historically from the current seasonal date over the next 5 to 60 Daily bars?
- Is a long-term seasonal effect also confirmed by recent years?
- Is the seasonal structure robust, or is it strongly influenced by outlier years?
- Is there local seasonal pressure around the current date?
The calculation is Daily-based. On supported intraday charts, the seasonal analysis remains anchored to the last confirmed Daily bar. Intraday bars do not change the seasonal statistics.
Classic Annual Curve
The Classic Annual Curve builds a synthetic seasonal path from January to December.
For each calendar day, the script calculates the historical average Daily return for that month/day slot. These average Daily returns are then accumulated or compounded from the beginning of the year.
The curve does not show where price has to move. It shows how the market has behaved on average throughout the calendar year over the selected lookback.
The additional Current Year path shows whether the current year is trading above, below, or close to this average seasonal structure.
Robust Seasonal Curve
The Robust mode does not use the average of individual Daily returns. Instead, it works with normalized historical yearly paths.
From these paths, the script calculates a median path and percentile bands. The bands show how much the historical years differ from each other. A narrow band suggests a more consistent seasonal structure. A wide band shows that historical paths varied significantly.
The percentile bands are historical dispersion areas. They are not future price ranges.
Tactical Profile
The Tactical Profile shows a local window around the current seasonal date. It checks whether the corresponding windows in prior years showed more positive, negative, or mixed Daily pressure.
The classification Long, Short, Range, or None describes local seasonal pressure only:
- Long means positive seasonal pressure
- Short means negative seasonal pressure
- Range means weak or neutral directional structure
- None means insufficient clarity or insufficient data
These states are not trading instructions. They only help describe the local seasonal environment.
Forward statistics
The Forward Stats table measures what historically happened from the current seasonal date over fixed future horizons.
Example:
30D does not mean the past 30 days.
30D means the historical return from the current seasonal date to +30 Daily bars in prior years.
For each horizon, the table shows the average, median, positive sample share, and available sample count. The median is especially useful because it is less sensitive to individual outlier years than the average.
Stability and Reliability
The script distinguishes between the requested lookback and the number of actually available samples. Especially with CFD symbols or shorter broker histories, a 25-year lookback may result in far fewer valid samples.
Reliability classifies this sample coverage as Good, Limited, or Weak.
The Stability row compares the full-lookback 30D forward effect with the recent 30D forward effect:
30D Δ: Full / Recent
Full uses the complete lookback.
Recent uses only the more recent years.
If both values differ significantly, the seasonal effect is less stable. This may indicate that an older seasonal structure is no longer clearly confirmed by more recent market behavior.
Turning points
Seasonal Peaks and Troughs mark filtered local highs and lows of the active seasonal curve. They show where the historical seasonal path structurally turned.
These markers are not reversal signals. They only help identify whether a seasonal phase has historically been near its beginning, middle, or a potential turning area.
Interpretation
The script is intended to make seasonal structure visible and comparable. It does not replace market analysis, risk management, or an assessment of the current market regime.
Seasonal patterns can be distorted by macro events, structural market changes, liquidity conditions, data source differences, symbol history, or different Daily close definitions.
For robust seasonal analysis, instruments with long and consistent historical data are generally preferable to symbols with short or reconstructed data histories.
The script does not generate entries, exits, price targets, stops, alerts, or strategy orders. Its role is to provide seasonal context and make recurring historical behavior easier to evaluate.
It is intended to complement a separate seasonal zone and quality indicator. Final zone validation, tradeability, and risk assessment remain outside the scope of this companion script.
Core idea
Seasonality is often misread because a rising average curve alone does not tell much about how stable or useful that effect actually is. This script separates several questions:
- What does the average seasonal path of the year look like?
- How far does the current year deviate from that path?
- What happened historically from the current seasonal date over the next 5 to 60 Daily bars?
- Is a long-term seasonal effect also confirmed by recent years?
- Is the seasonal structure robust, or is it strongly influenced by outlier years?
- Is there local seasonal pressure around the current date?
The calculation is Daily-based. On supported intraday charts, the seasonal analysis remains anchored to the last confirmed Daily bar. Intraday bars do not change the seasonal statistics.
Classic Annual Curve
The Classic Annual Curve builds a synthetic seasonal path from January to December.
For each calendar day, the script calculates the historical average Daily return for that month/day slot. These average Daily returns are then accumulated or compounded from the beginning of the year.
The curve does not show where price has to move. It shows how the market has behaved on average throughout the calendar year over the selected lookback.
The additional Current Year path shows whether the current year is trading above, below, or close to this average seasonal structure.
Robust Seasonal Curve
The Robust mode does not use the average of individual Daily returns. Instead, it works with normalized historical yearly paths.
From these paths, the script calculates a median path and percentile bands. The bands show how much the historical years differ from each other. A narrow band suggests a more consistent seasonal structure. A wide band shows that historical paths varied significantly.
The percentile bands are historical dispersion areas. They are not future price ranges.
Tactical Profile
The Tactical Profile shows a local window around the current seasonal date. It checks whether the corresponding windows in prior years showed more positive, negative, or mixed Daily pressure.
The classification Long, Short, Range, or None describes local seasonal pressure only:
- Long means positive seasonal pressure
- Short means negative seasonal pressure
- Range means weak or neutral directional structure
- None means insufficient clarity or insufficient data
These states are not trading instructions. They only help describe the local seasonal environment.
Forward statistics
The Forward Stats table measures what historically happened from the current seasonal date over fixed future horizons.
Example:
30D does not mean the past 30 days.
30D means the historical return from the current seasonal date to +30 Daily bars in prior years.
For each horizon, the table shows the average, median, positive sample share, and available sample count. The median is especially useful because it is less sensitive to individual outlier years than the average.
Stability and Reliability
The script distinguishes between the requested lookback and the number of actually available samples. Especially with CFD symbols or shorter broker histories, a 25-year lookback may result in far fewer valid samples.
Reliability classifies this sample coverage as Good, Limited, or Weak.
The Stability row compares the full-lookback 30D forward effect with the recent 30D forward effect:
30D Δ: Full / Recent
Full uses the complete lookback.
Recent uses only the more recent years.
If both values differ significantly, the seasonal effect is less stable. This may indicate that an older seasonal structure is no longer clearly confirmed by more recent market behavior.
Turning points
Seasonal Peaks and Troughs mark filtered local highs and lows of the active seasonal curve. They show where the historical seasonal path structurally turned.
These markers are not reversal signals. They only help identify whether a seasonal phase has historically been near its beginning, middle, or a potential turning area.
Interpretation
The script is intended to make seasonal structure visible and comparable. It does not replace market analysis, risk management, or an assessment of the current market regime.
Seasonal patterns can be distorted by macro events, structural market changes, liquidity conditions, data source differences, symbol history, or different Daily close definitions.
For robust seasonal analysis, instruments with long and consistent historical data are generally preferable to symbols with short or reconstructed data histories.
Phát hành các Ghi chú
Regime Match Compare: compares all-years seasonality vs. the matching market phase, including trend, volatility, and drawdown context.Compact Evidence / Risk Context Summary → better assessment of seasonality quality.
Phát hành các Ghi chú
Panel modes revised.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.