INVITE-ONLY SCRIPT

SMT Divergence - Time & Calendar Cycles

33
SMT Divergence - Time & Calendar Cycles

This indicator is a specialized tool designed to detect SMT divergences across multiple fractal structures.

It is powered by a proprietary Cycle Engine, which utilizes a dual-layer processing system to filter, rank, and render divergences based on strict Time Cycles (e.g., 90-minute rolling windows) and Calendar Cycles (e.g., Daily/Weekly structure).

Specifically engineered for precision analysis, this tool features a proprietary architecture that separates permanent historical data from real-time price action, ensuring both backtesting reliability and live execution speed.


1. Core Concept: Automated SMT Detection
SMT Divergences occur when correlated instruments fail to confirm each other's price action at key structural pivots. For example, if the Nasdaq (NQ) makes a higher high while the S&P 500 (ES) fails to do so, this crack in correlation can signal an engineered liquidity grab or an impending reversal.

This indicator automates this analysis by comparing the Main Chart against up to three user-defined "Witness" symbols. It supports Direct Correlation (e.g., NQ vs. ES) and Inverse Correlation (e.g., EURUSD vs. DXY), where the logic automatically inverts to flag Higher Highs vs. Higher Highs as valid divergences. It also features unique "Witness vs. Witness" logic, which cross-verifies the comparison symbols against each other (e.g., Symbol 1 vs. Symbol 2) to find internal market weakness, even if the main chart is currently neutral.
snapshot


2. How It Works: The Dual-Engine System
To accurately map fractal price action, the indicator splits its logic into two distinct engines which run simultaneously:

2.1 Time Cycles (Intraday Analysis)
Designed for Intraday Macro analysis (targeting specific time windows like 90-minute or 30-minute cycles). These cycles are strictly bound to a user-defined trading session (e.g., 09:30 - 16:00) and repeat continuously (roll over) throughout the entire window until the session ends. At the beginning of every new session, all Time Cycle data is cleared. This ensures that the indicator searches for fresh liquidity voids specific to the current trading day, preventing data pollution from previous days.

2.2 Calendar Cycles (Macro Analysis)
Designed for Higher Timeframe (HTF) structural analysis, monitoring Daily, Weekly, Monthly, Quarterly, and Yearly periods. Unlike Time Cycles, Calendar Cycles utilize persistent data arrays that survive session resets. This allows the tool to detect Multi-Day or Multi-Week divergences effectively. It offers smart calculation modes, including "Exchange Session" to prevent ghost lines on Futures charts.
snapshot


3. The Unified SMT Visualization Architecture
The system's core achievement is the Fractal Time Synthesis, unifying micro (Intraday) and macro (Calendar) analysis by simultaneously projecting divergence signals from Session-Anchored Time Cycles and Continuous Calendar Cycles onto a single chart view. This provides immediate, comprehensive multi-timeframe structural bias verification.

The structural data is clearly delineated into two states: the correct past and the correct live divergences. Divergences from completed cycles are displayed as a definitive record, providing non-repainting historical validation. Concurrently, setups forming currently are tracked dynamically, ensuring real-time responsiveness for analysis across all cycles being monitored.
snapshot


4. How To Use This Tool
  1. Configuration: Set your Timezone and Session Start/End times in the settings. This ensures the "Time Cycles" align correctly with your specific market.
  2. Select Symbols: Input your comparison symbols (e.g., ES, YM, or inversely DXY). Ensure the "Inverse" toggle is checked for negatively correlated assets.
  3. Cycle Selection: Enable the specific cycles relevant to your strategy (e.g., Daily + 90m Macro).
  4. Render History: Always scroll the chart back to the very beginning of your available price history after loading the indicator or changing timeframes. This ensures the maximum historical data is processed for accurate divergence calculation.
  5. Interpretation - The system flags two conditions: 'Bearish SMT' (Price makes a Higher High, but the correlated asset makes a Lower High) & 'Bullish SMT' (Price makes a Lower Low, but the correlated asset makes a Higher Low)
  6. Confluence: Use the "Live" lines for real-time analysis, and refer to the "Historian" lines to understand the higher timeframe bias.



5. Key Features

5.1 Multi-Symbol & Correlation
  • Triple-Check Logic: Capable of comparing the Main Chart against Symbol 1, Symbol 2, and Symbol 3 simultaneously.
  • Cross-Symbol Check: The script can optionally validate Symbol 1 against Symbol 2 (e.g., checking ES vs. YM) and plot the result on your NQ chart, giving you a complete market breadth view.


5.2 Structural Range Validation
The script includes strict validation logic to ensure high-quality data. It automatically verifies that the detected highs and lows are the true extremes of the cycle range. If price action within the cycle breaches the anchor points, the signal is considered structurally invalid and will not be drawn.

This validation process is dynamically controlled by the Lookback Cycles setting. Users define the exact number of preceding historical cycles the current structure must be compared against (e.g., comparing against the last 9 cycles), allowing for customization of the structural depth.


5.3 Professional Drawing & Chart Management
  • Collision Engine: A proprietary memory map tracks every pixel drawn on the chart. If a lower timeframe cycle tries to draw over a higher timeframe cycle, the engine blocks or suppresses the lower priority signal based on your settings.
  • Data Integrity: The script automatically validates cycle duration to ensure signals do not span across abnormal time gaps or missing data.
  • Garbage Collection: The script actively manages internal memory to prevent crashes, allowing for deep backtesting history on lower timeframes.


5.4 Full Customization
  • Adaptive Coloring: Labels and text automatically switch between black and white based on your background brightness to ensure readability.
  • Visual Control: Fully customizable line styles, widths, and colors for every individual cycle.



Disclaimer
This indicator is for educational and analytical purposes only. SMT Divergence is a concept used to interpret market structure and does not constitute financial advice or a signal to trade. Past performance is not indicative of future results.

Clause de non-responsabilité

Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.