OPEN-SOURCE SCRIPT
מעודכן SeasonalTrader Pro - Seasonal Edge Scanner

SeasonalTrader Pro - Seasonal Edge Scanner is a Daily-based seasonal statistics scanner. It searches for recurring calendar-window behavior by comparing the current seasonal period with the same historical periods over a configurable lookback range.
The script scans potential entry and exit windows within a defined Daily scan horizon and evaluates Long, Short, and Range/Mean-Reversion candidates. All statistical calculations are based on Daily data. Lower chart timeframes can be used for visualization and trade observation, but they do not change the scan basis.
Methodology
For each tested seasonal window, the script compares the same calendar period across historical years and calculates directional and range-based statistics.
Directional Long/Short statistics include:
- historical win rate
- average return
- average drawdown
- SQN-style consistency metric
- sample count
- MAE/MFE-based risk and target reference levels
- recent stability and outlier impact checks
Range/Mean-Reversion statistics include:
- average historical range size
- net movement relative to the full range
- range efficiency
- close-inside rate
- breakout rate
- range quality and range eligibility
The scanner then applies an Auto Quality layer. This layer ranks and filters candidates using sample confidence, raw score, final quality grade, separation from competing Long/Short/Range candidates, outlier risk, stability, plateau robustness, and tradeability context.
AutoQ / Quality Engine
The AutoQ system is used to reduce weak or isolated seasonal candidates. It is not a trade signal by itself.
Quality evaluation includes:
- confidence-adjusted win rate
- minimum sample depth
- average return and drawdown requirements
- SQN contribution
- Long/Short/Range separation
- outlier and overfit checks
- recent-year stability
- plateau robustness around the selected window
- tradeability state of the current seasonal window
The Quality Strength setting controls how strict this filter is. A value of 0 enables a reference scan mode based mainly on the raw minimum win rate.
Bias Classification
The indicator can classify the current seasonal context as:
- LONG Bias
- SHORT Bias
- RANGE / MR Bias
- NO EDGE
The bias classifier compares the best eligible directional and range candidates. In Auto mode, Range only wins when the range score and quality context are strong enough compared with the directional alternatives. Directional-only and Range-only modes are also available.
Seasonal Potential Panel
The Seasonal Potential panel evaluates the currently selected Daily edge after the quality filter. It does not describe a general market bias. It evaluates whether the selected seasonal idea still has usable potential at the current point in the window.
The panel combines:
- current tradeability state: Pre, Active, Late, Expired, Invalidated, No Edge
- volatility fit
- move used or range position
- remaining potential
- seasonal risk/reward
- invalidation distance or breakout risk
- robustness score
- outlier risk
- final quality summary
For directional setups, the potential model uses historical MFE/MAE behavior to estimate remaining move, late-entry risk, and invalidation context. For range setups, it evaluates range position, range expansion, mean-reversion behavior, and breakout risk.
Risk / Reward Bands
The optional Risk/Reward bands are derived from the selected Daily seasonal window and its historical MAE/MFE distribution.
Displayed levels may include:
- Median MFE
- 75th percentile MFE
- Median MAE
- 75th percentile MAE
These levels are statistical reference areas only. They are not fixed targets, stops, or execution rules.
Historical Verification
The script can display historical verification periods on the chart and in a table. This allows visual inspection of how the selected seasonal window behaved in previous years.
Directional verification shows yearly profit/loss and drawdown.
Range verification shows range efficiency, range size, net movement, and whether the historical window behaved as range, mean-reversion, or breakout.
Projection and Zone Locking
Future seasonal zones are projected from Daily timestamps. The script supports projected Long, Short, Range, Best Zone, or All Regime views.
Visible zones are stabilized through a lock mechanism:
- active zones remain locked until expiry
- pending zones can update depending on the selected pending-lock policy
- projected timestamps can use either trading-day estimation or calendar-day projection
This is intended to prevent visible zones from shifting unnecessarily once a seasonal window becomes active.
Alerts
The script provides alert conditions for selected seasonal state changes, including:
- potential becoming strong or weak
- late-entry risk
- move exhaustion
- invalidation
- 75% MFE reached
- weak robustness
- high outlier risk
- expired or invalidated window
- range breakout risk
Alerts refer to the selected seasonal edge and should be interpreted together with the chart context.
Important Limitations
This is a statistical analysis tool, not a standalone trading system.
The indicator does not place orders, define position sizing, or account for commissions, spread, slippage, funding costs, or execution quality. Seasonal behavior can change due to regime shifts, macro conditions, liquidity changes, market structure changes, or symbol-specific events.
All main calculations are Daily-based. Lower timeframes may help with execution timing, but they do not increase the statistical sample size or change the seasonal scan.
Historical recurrence does not guarantee future behavior. The output should be used as contextual information together with independent market analysis and risk management.
The script scans potential entry and exit windows within a defined Daily scan horizon and evaluates Long, Short, and Range/Mean-Reversion candidates. All statistical calculations are based on Daily data. Lower chart timeframes can be used for visualization and trade observation, but they do not change the scan basis.
Methodology
For each tested seasonal window, the script compares the same calendar period across historical years and calculates directional and range-based statistics.
Directional Long/Short statistics include:
- historical win rate
- average return
- average drawdown
- SQN-style consistency metric
- sample count
- MAE/MFE-based risk and target reference levels
- recent stability and outlier impact checks
Range/Mean-Reversion statistics include:
- average historical range size
- net movement relative to the full range
- range efficiency
- close-inside rate
- breakout rate
- range quality and range eligibility
The scanner then applies an Auto Quality layer. This layer ranks and filters candidates using sample confidence, raw score, final quality grade, separation from competing Long/Short/Range candidates, outlier risk, stability, plateau robustness, and tradeability context.
AutoQ / Quality Engine
The AutoQ system is used to reduce weak or isolated seasonal candidates. It is not a trade signal by itself.
Quality evaluation includes:
- confidence-adjusted win rate
- minimum sample depth
- average return and drawdown requirements
- SQN contribution
- Long/Short/Range separation
- outlier and overfit checks
- recent-year stability
- plateau robustness around the selected window
- tradeability state of the current seasonal window
The Quality Strength setting controls how strict this filter is. A value of 0 enables a reference scan mode based mainly on the raw minimum win rate.
Bias Classification
The indicator can classify the current seasonal context as:
- LONG Bias
- SHORT Bias
- RANGE / MR Bias
- NO EDGE
The bias classifier compares the best eligible directional and range candidates. In Auto mode, Range only wins when the range score and quality context are strong enough compared with the directional alternatives. Directional-only and Range-only modes are also available.
Seasonal Potential Panel
The Seasonal Potential panel evaluates the currently selected Daily edge after the quality filter. It does not describe a general market bias. It evaluates whether the selected seasonal idea still has usable potential at the current point in the window.
The panel combines:
- current tradeability state: Pre, Active, Late, Expired, Invalidated, No Edge
- volatility fit
- move used or range position
- remaining potential
- seasonal risk/reward
- invalidation distance or breakout risk
- robustness score
- outlier risk
- final quality summary
For directional setups, the potential model uses historical MFE/MAE behavior to estimate remaining move, late-entry risk, and invalidation context. For range setups, it evaluates range position, range expansion, mean-reversion behavior, and breakout risk.
Risk / Reward Bands
The optional Risk/Reward bands are derived from the selected Daily seasonal window and its historical MAE/MFE distribution.
Displayed levels may include:
- Median MFE
- 75th percentile MFE
- Median MAE
- 75th percentile MAE
These levels are statistical reference areas only. They are not fixed targets, stops, or execution rules.
Historical Verification
The script can display historical verification periods on the chart and in a table. This allows visual inspection of how the selected seasonal window behaved in previous years.
Directional verification shows yearly profit/loss and drawdown.
Range verification shows range efficiency, range size, net movement, and whether the historical window behaved as range, mean-reversion, or breakout.
Projection and Zone Locking
Future seasonal zones are projected from Daily timestamps. The script supports projected Long, Short, Range, Best Zone, or All Regime views.
Visible zones are stabilized through a lock mechanism:
- active zones remain locked until expiry
- pending zones can update depending on the selected pending-lock policy
- projected timestamps can use either trading-day estimation or calendar-day projection
This is intended to prevent visible zones from shifting unnecessarily once a seasonal window becomes active.
Alerts
The script provides alert conditions for selected seasonal state changes, including:
- potential becoming strong or weak
- late-entry risk
- move exhaustion
- invalidation
- 75% MFE reached
- weak robustness
- high outlier risk
- expired or invalidated window
- range breakout risk
Alerts refer to the selected seasonal edge and should be interpreted together with the chart context.
Important Limitations
This is a statistical analysis tool, not a standalone trading system.
The indicator does not place orders, define position sizing, or account for commissions, spread, slippage, funding costs, or execution quality. Seasonal behavior can change due to regime shifts, macro conditions, liquidity changes, market structure changes, or symbol-specific events.
All main calculations are Daily-based. Lower timeframes may help with execution timing, but they do not increase the statistical sample size or change the seasonal scan.
Historical recurrence does not guarantee future behavior. The output should be used as contextual information together with independent market analysis and risk management.
הערות שחרור
Panel position revised.הערות שחרור
Engine update: switched to internal seasonal curve logic for discrete zone detection and more stable projections.הערות שחרור
Tooltips updated.הערות שחרור
Bug fixed. Scanner stabilized.הערות שחרור
Major architecture overhaul: timestamp-based zone lifecycle/registry, unified Long/Short engine, corrected Short and Range mathematics, deterministic locked-zone selection, and real historical plateau validation.Added training/holdout separation, Wilson confidence, improved evidence/risk metrics, consistent Daily-to-Intraday state, and clearer quality, OOS, timing, and risk presentation.
הערות שחרור
Removed range zones.הערות שחרור
Bar Replay fixed. סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.