Intermarket divergence

How to evaluate an SMT divergence indicator on TradingView

An SMT divergence indicator compares swing extremes in two markets: one makes a new high or low while the other does not. To choose a TradingView script, check how it matches swings, when pivots become confirmed, and what it does when a market has no data. This page provides an evaluation method, not a tested product ranking. A divergence alone does not prove institutional buying or selling, or predict a reversal.

Draft your SMT detector

What makes an SMT indicator suitable for your rules?

There is no universal winner established here. A useful script exposes enough of its rules to reproduce each marker. Open source makes inspection possible; a protected script needs clear documentation and observable behavior. A price chart can show disagreement between markets, but cannot identify who placed the orders.

CheckEvidence to look forReason to withhold judgment
Swing definitionLeft/right pivot lengths, equal-high tolerance, and matching windowOnly a sensitivity slider with no rule explanation
Signal timingSeparate swing timestamp and detection timestampHistorical markers appear early with no delay disclosed
Data alignmentExact ticker IDs, sessions, and missing-data statusA closed peer market still generates divergence
Alert behaviorA documented trigger and one alert per confirmed eventMarkers and alerts use different conditions
Performance claimsA complete trade model, costs, dates, and unseen test periodWin rate attached to a marker without entry or exit rules

A reproducible bullish and bearish SMT definition

The following is a proposed test specification for positively related instruments, not a universal ICT standard or a measured trading edge. Use standard candles at one interval. Define a strict swing high as higher than the three bars on either side, and a strict swing low as lower than them; ties are excluded. Pair same-type pivots only when their swing timestamps match exactly. This deliberately strict rule can miss nearby swings, but avoids silently comparing unrelated events.

  • Apply the same conditions with A and B swapped. Compare each price with its own prior pivot, not with the absolute price of the other instrument.
  • Evaluate only after both pivots are confirmed. With three right-hand bars, the earliest detection is the close of the third subsequent bar in both markets.
  • For this test, require two consecutive matched swing pairs within one shared session and complete bars over each pivot window. Reset the reference when the shared session ends or data is missing.
  • Record the two swing timestamps, four pivot prices, and detection timestamp for each event. A line drawn back to a pivot must not imply that the signal was available there.
  • A wider matching window is a different model. Specify its maximum delay, matching order, and whether a pivot can be reused before comparing results.
ConditionInstrument AInstrument BResult
Bullish candidateNew matched low below its prior matched lowNew matched low above its prior matched lowBullish SMT under this definition
Bearish candidateNew matched high above its prior matched highNew matched high below its prior matched highBearish SMT under this definition
Both extendNew low or high beyond its prior levelSame-direction break beyond its own prior levelNo SMT candidate
Equal or unavailableEqual pivot, missing bar, or unconfirmed swingAny stateSkip the comparison

Align the two markets before comparing swings

Matching the chart timezone is not sufficient. Match actual bar opening and closing timestamps, use the same interval, and restrict comparisons to hours when both instruments have bars. TradingView time values represent timestamps; the displayed chart timezone does not change Pine calculations. Session settings and exchange timezones still affect which bars belong in the sample.

  • Record the exchange-qualified ticker for each instrument and whether data is delayed. Mixing a delayed feed with a live feed can make the comparison appear to lead or lag.
  • Use one explicit shared session and timezone. Check holidays, daylight-saving changes, and partial sessions instead of assuming both markets always open together.
  • For futures, record contract month or continuous-contract settings. Review roll periods separately because a contract transition can alter the price series.
  • Skip an event when the peer timestamp or a required price is absent. Forward-filled prices can look like a held high or low while the peer is closed.

Pairs, correlation changes, and gold

ES and NQ, EUR/USD and GBP/USD, or gold and silver are candidate comparisons, not permanent correlation guarantees. Verify the relationship over the interval and session being studied. Specify whether a correlation check uses prices or returns and state its lookback; changing either changes the measurement. The TradingView Correlation Coefficient documentation notes that relationships can change over time.

  • For gold, choose the exact XAUUSD or gold-futures feed and an explicitly identified silver feed. Align sessions and avoid treating a CFD and a futures contract as identical data.
  • If a model assumes positive correlation, suspend its directional labels when that premise fails under your predefined correlation rule.
  • DXY comparisons require a separately defined inverse model, such as comparing a low in one market with a high in the other. Do not reuse the positive-pair table unchanged.
  • The slope of a line between swings describes price change over time. Chart scale affects its visual angle; the angle does not measure limit-order absorption or institutional participation.

Pine Script behavior to inspect

A custom SMT detector can request another symbol with request.security() and evaluate objective swing rules. Ask for timestamps and data-availability checks alongside prices. Missing-data handling, historical marker placement, and the confirmation rule belong in the specification before you generate code.

  • Inspect the gaps setting. barmerge.gaps_on exposes missing values as na, while gaps_off can fill them. Neither setting replaces a timestamp and session check.
  • Do not accept lookahead_off as a blanket non-repainting guarantee. Developing higher-timeframe values can change before that timeframe closes.
  • For confirmed higher-timeframe requests, TradingView documents a one-bar offset in the requested expression together with lookahead_on. Apply it only in a genuinely higher-timeframe request and disclose the delay.
  • Keep alert timing on the detection bar. Verify each requested series independently; confirmation of the chart bar alone does not establish that another data context is final.

A comparison procedure you can repeat

This procedure has not been run as a product benchmark. Use it to compare scripts with the same definition, dataset, and settings. A rolling-window detector and a confirmed-pivot detector answer different questions, so their marker counts alone cannot establish which is better.

  • Freeze both tickers, interval, sessions, pivot lengths, matching rule, and evaluation dates before collecting examples.
  • For each marker, log the source prices and the first bar where the condition was knowable. Include no-signal cases where both markets break, prices tie, or data is missing.
  • Reload the chart and compare saved markers. Then forward-observe alerts to check whether their arrival agrees with the documented confirmation delay; historical charts alone do not establish live behavior.
  • Report detection mismatches and skipped observations before discussing returns. For a trading test, separately define instrument, entry, invalidation, stop, exit, fees, and slippage.
  • If adding an IFVG entry filter, define its gap, inversion, and retest conditions separately. Compare the combined rule on an unseen period rather than assuming SMT confirms a reversal.
Where Pineify fits

Pine Script AI Coding Agent

Give the agent your two ticker IDs, swing-matching rules, session, missing-data policy, and alert timing to draft a custom SMT detector. Review syntax diagnostics and verify its behavior in TradingView.

Draft your SMT detector

Frequently asked questions

Educational information, not investment advice. The proposed rules and comparison procedure are not measured performance results. Correlation can change, signals can fail, and trading can lose money.

Sources and verification