OPEN-SOURCE SCRIPT
Seasonality Calculation & Statistics

Seasonality Calculation & Statistics
Key Features
Visual Chart Elements
Dashboard Tables
1. Summary Table: Displays overall strategy performance across the entire selected backtest horizon
2. Yearly Table: Provides a granular, year-by-year historical audit containing
3. Period Summary Table: Breaks down win rates across customizable historical segments (e.g., last 3, 5, 10, or 15 years) to help identify if a seasonal pattern is strengthening, decaying, or completely cooked in modern market regime
How to Use
- The Seasonality Calculation & Statistics indicator is a quantitative tool designed to backtest, track, and visually analyze specific seasonal recurring calendar patterns across historical data directly on the daily timeframe
- It eliminates guesswork by isolating user-defined date windows (e.g., May 1 to May 15), calculating historical performance metrics, projecting upcoming seasonal cycles, and providing detailed table dashboards
Key Features
- Custom Seasonal Windows: Define exact start and end dates (Day/Month) and evaluate both Long and Short seasonal directions
- Smart Vertical Timeline Markers: Clean visual boundaries marking every historical cycle and projecting upcoming future opportunities
- Shifted Exit Boundary for Visual Clarity: The vertical exit line is deliberately placed one trading day to the right ($t + 1$), cleanly enclosing the entire holding period so you can analyze every historical price bar inside the pattern without overlapping visual obstruction
- Three Built-in Statistical Tables: Comprehensive performance summaries, year-by-year logs, and multi-period lookback comparisons
- SQN & Risk Metrics: Real-time calculation of System Quality Number (SQN), Win Rate, Average Return, Average Profit, and Maximum/Average Drawdown
Visual Chart Elements
- Entry Line & Label: A vertical line (default lime) placed on the entry candle close
- Shifted Exit Line & Label: A vertical boundary line (default red) shifted one trading day to the right of the exit candle, framing the trade window perfectly for post-trade review
- Result Badges: Clean floating labels displaying the percentage return and maximum intra-trade drawdown for each individual year
- Future Projections: Forward-projected dashed lines plotted into empty chart space to highlight when the next seasonal window opens and closes
Dashboard Tables
1. Summary Table: Displays overall strategy performance across the entire selected backtest horizon
- Direction (Long / Short)
- Calendar Window & Trade Duration
- Winning Trades ratio and Win Rate percentage
- Average Return and Average Winning Trade Profit
- Average Drawdown and Maximum Intra-trade Drawdown
- System Quality Number (SQN) to evaluate statistical edge
2. Yearly Table: Provides a granular, year-by-year historical audit containing
- Specific trading cycle year
- Executed start and end dates
- Trade Return (%)
- Trade Maximum Drawdown (%)
3. Period Summary Table: Breaks down win rates across customizable historical segments (e.g., last 3, 5, 10, or 15 years) to help identify if a seasonal pattern is strengthening, decaying, or completely cooked in modern market regime
How to Use
- Apply the indicator to any asset on the Daily (1D) timeframe
- Set your desired seasonal window via Start Day / Start Month and End Day / End Month
- Select Long or Short bias
- Adjust the lookback starting years to focus on specific economic cycles
- Use the projected lines to prepare for upcoming seasonal setups ahead of time
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。