Zaktualizowano

Symbol vs NQ [BMT]

385
Symbol vs NQ [BMT]

Is the symbol on the chart adding something of its own, beyond how much more it moves than the Nasdaq does, and does it need megacap leadership to work? The name's move from a shared anchor, minus its beta to NQ times NQ's move from the same anchor, is the residual: above zero the name is beating the path its beta implies, below zero it is rising less than its beta alone would have delivered. The chart is tinted by that state.

What it draws

A background tint on the price chart: green while the name is beating its NQ-beta path by more than the threshold, red while it is missing it, nothing in between. A stronger green marks a confirmed lead, and a triangle under each confirmed bar (size is an input) carries a hover reading. A vertical line marks the anchor bar. A status table along one edge shows the name's move, its residual and sigma, its beta to NQ, NQ's own move and state, the regime profile, and the anchor in force.

The green takes the stairs up and the elevator down. It needs four consecutive bars above the threshold before it paints, and it drops the moment the residual is back at or under zero rather than waiting for minus the threshold. Red is immediate both ways. That is the asymmetry of the CARS state machine, and it is what keeps the tint from flickering on one-bar noise without smoothing away the turns.

While the name closes under its 50-day average, a positive residual is discounted to 70% before the threshold applies (an input, on by default). A discount, never a veto: a name can still read as leading under its 50-day, it just needs more to get there, and a lagging reading is never damped since that would slow the off-switch. The 50-day is read from the daily bars on every chart timeframe, the prior session's value, so it does not repaint.

The anchor

Measure picks the bar both series are measured from; the name and NQ always share it. The period anchors are the same bars Index Lead Lag [BMT] uses, so with both on the chart they agree; the swing anchors are NQ's extremes where that script uses ES's.

  • Auto (default) chooses from the chart timeframe: session open under an hour, week open intraday above that, month open on a daily chart, quarter open above. The Ref cell shows what it resolved to.
  • Session open, Prior close, Week open, Month open, Quarter open. Each resets on its boundary. On CME index futures the daily bar opens at 18:00 ET, so Session open is the Globex open and the overnight sits inside the measure; Prior close is the 17:00 settlement.
  • RTH open: the open of the first bar of the cash session (09:30 to 16:00 New York by default, an input), with the overnight left out.
  • NQ swing low / NQ swing high: the lowest low or highest high NQ has printed in the range on screen, so it reads as "since the Nasdaq turned, has this name done more than its beta?". Pan or zoom and it re-resolves to the new view. NQ's turn rather than the name's own on purpose: a name measured from its own low is at its minimum there by construction, which flatters every residual.
  • Fixed date: a date from the date picker. Does not reset.


The period anchors are read as prices from a higher-timeframe request rather than counted back as bars, so there is no history-buffer limit on how far back an anchor can sit.

Beta and the residual

Beta is the ordinary least squares slope of the name's bar returns against NQ's, fitted on the bars before the one being scored so a bar cannot explain itself away, over a window of four anchor periods on the chart's own bars (four sessions for a session anchor, four months for a month anchor, four times the span for a swing or a date; floor 60 bars, cap 2000). Sizing the window from the anchor keeps beta fitted at the horizon it is subtracted over. The table shows the bars in use.

The residual is scored in standard deviations of where it could have drifted by chance by this point in the period: per-bar residual noise times the square root of bars since the anchor. Early in a period it takes less to clear the threshold and late in a period it takes more, rather than one yardstick set by the period's average size. The sigma is measured on the name's own per-bar residual, so 1.0 means the same thing for a stock as for an index even though the stock moves several times as far.

Until the beta window has filled there is no beta and no reading, and the table says so: a recent listing with fewer bars than the window shows n/a and the bar count against the window, because a name that cannot be measured is not a weak name.

Confirmed leads

Beating a beta while merely quiet is a read that inverts by regime: in a panic the names that have not yet fallen can be the best shorts, not the best buys. So a lead is confirmed only when the name is also at a period high NQ has not made, the upside leg, which is the half of the read that holds in both regimes. An unconfirmed lead is not nothing; it is a sign whose direction you cannot yet read. There is no mirror on the lag side.

Regime profile

NQ's own state against its beta to ES is tracked the same way, and the table shows what the name's residual has averaged while NQ was leading its beta and while NQ was lagging it, over about the last 50 qualifying bars of each. A wide gap says the name rides megacap leadership and NQ's state matters to it; two similar numbers say it trades on its own.

NQ source

Futures (NQ1!, with ES1! for the NQ regime) intraday, where the cash index has no overnight bars; the cash index (NDX, with SPX) on daily and above, where a long anchor would otherwise carry the futures' roll gaps. Auto chooses by timeframe; the Ref cell says which is in use.
Informacje o Wersji
v1.0.1

Fixed: on daily and weekly charts of a stock, NQ arrived one bar late, and the beta to NQ came out near zero. The cash index's daily bar closes after a stock's (NDX is calculated to 17:16 ET), and TradingView merges same-timeframe requests by close time, so every historical bar carried the previous day's index close and each day's return was regressed against the wrong day's NQ return. Measured on DELL: beta read -0.05 against a true 1.8, and the regime profile counted 2 leading bars against 655. The chart-timeframe requests now use lookahead on, which on the same timeframe is the bar's own close and nothing from the future. Verified on the same chart afterwards: beta 1.94, and NQ's month-to-date moves matching the index. Futures and intraday charts were aligned before and are unchanged. Every reading on a daily stock chart changes with this update; the tint, the markers and the profile from v1.0.0 on those charts were built on the misaligned series.

New: Box alpha days, off by default. Outlines the days the stock produced alpha of its own: green for outperformance against beta x NQ, red for underperformance, beyond two standard deviations of its own daily noise. The tint adds these days up since the anchor and smooths them over, so one huge day inside a lagging stretch, or a bad day inside a leading one, showed up nowhere before. Bar alpha (sigma) is in the data window.

Changed: earlier anchors are marked as small ticks along the bottom edge rather than one-bar bands, which on a daily chart were solid columns and hid the anchor line among them. The confirmed-lead marker's size ladder is rebalanced (normal is now the character at its largest; only large is the shape, and it sits a third of an ATR clear of the bar) and its switch is folded into the picker as Off. The 50-day damping is always on; its switch is gone, and the undamped sigma stays in the data window. The Show status table switch is folded into the location picker, now titled Status table, as a Hidden entry, which is also the default; a chart that had the switch on keeps its saved location.
Informacje o Wersji
v1.1.0

New: held up. A diamond under the bar, and "held up" as the table header, when the name is flat or up since the anchor while NQ is down by more than the threshold in its own sigma. The residual subtracts beta, so a low-beta name holding flat through a selloff read as near beta, which is correct as alpha and wrong as what a trader means by a stock that refuses to go down. This state is scored on the raw moves, bar by bar, and it is shown even where the NQ link is too weak for the tint. It is rare by design, a few episodes a year on a typical name. The marker size picker now covers both markers; a Held up marker switch turns the diamond off on its own.

v1.0.2

Fixed: on intraday stock charts the beta to NQ was set by the overnight gaps. A stock's 15-minute chart has cash-session bars only, so its 09:30 bar carries the whole overnight move, and so does NQ's paired bar: a 16-hour return sitting in a regression of 15-minute returns, ten times their size, four of them in a four-session window. Measured on DELL 15m: beta 3.1 with those bars in, 1.0 with them out, and the script read 4.0, which turned an ordinary day into a +3.5 residual. Bars whose time step is more than 1.5x the chart timeframe now contribute nothing to the beta or the per-bar sigma. They stay in the move since the anchor, so a large gap reads as an alpha day against the intraday noise rather than being absorbed into the beta. Daily and higher charts are unchanged. On a futures chart the bar after the maintenance hour is treated the same way.

Also intraday: the beta window is eight anchor periods, up from four (daily and higher stay at four). Bar returns intraday are far noisier against the index than daily ones, and four sessions left the beta's standard error near half its value; eight halves the variance for a window still under two weeks.

New: no NQ link. The name's correlation to NQ over the past two years (a long window on purpose: the link is a structural property of the name, and a single year in which it traded on its own news does not remove it) now shows beside the beta, and below 0.3 the tint, the confirmed markers and the alpha-day boxes are withheld and the table says so; above 0.95 likewise, since the symbol is then NQ or a tracker and the residual is basis or tracking error (NQ1! against the cash index had the cost of carry painted as lagging). On a name NQ does not explain (a managed-futures fund read as +2.5 sigma of "alpha", a pharma name with a beta that flipped sign twice in a year) the residual is the raw move, and coloring it turned a relative-strength read into a trend meter. The numbers stay, as a trend read; the profile in particular is where "does not need NQ" is a real finding.

Also: the table's second-column header now states the reading in words (leading, lagging, near beta, confirmed, no NQ link, tracks NQ) rather than relying on the cell color, the ticker cell's tooltip opens with how to read the table, and the table is on by default (bottom right), since it is the key to the colors.

Removed: the NQ swing low / high and Fixed date measures. This script asks about the current session, week or month; a long arbitrary anchor stretched the beta window to years, made "confirmed" fire on any high since the date, and left the regime profile a single period to count, which is how a managed-futures fund read as +2.5 sigma of alpha against the Nasdaq. Charts saved on one of them fall back to Auto. Index Lead Lag keeps both, where "who led since the March low" is the point.


v1.0.1

Fixed: on daily and weekly charts of a stock, NQ arrived one bar late, and the beta to NQ came out near zero. The cash index's daily bar closes after a stock's (NDX is calculated to 17:16 ET), and TradingView merges same-timeframe requests by close time, so every historical bar carried the previous day's index close and each day's return was regressed against the wrong day's NQ return. Measured on DELL: beta read -0.05 against a true 1.8, and the regime profile counted 2 leading bars against 655. The chart-timeframe requests now use lookahead on, which on the same timeframe is the bar's own close and nothing from the future. Verified on the same chart afterwards: beta 1.94, and NQ's month-to-date moves matching the index. Futures and intraday charts were aligned before and are unchanged. Every reading on a daily stock chart changes with this update; the tint, the markers and the profile from v1.0.0 on those charts were built on the misaligned series.

New: Box alpha days, off by default. Outlines the days the stock produced alpha of its own: green for outperformance against beta x NQ, red for underperformance, beyond two standard deviations of its own daily noise. The tint adds these days up since the anchor and smooths them over, so one huge day inside a lagging stretch, or a bad day inside a leading one, showed up nowhere before. Bar alpha (sigma) is in the data window.

Changed: earlier anchors are marked as small ticks along the bottom edge rather than one-bar bands, which on a daily chart were solid columns and hid the anchor line among them. The confirmed-lead marker's size ladder is rebalanced (normal is now the character at its largest; only large is the shape, and it sits a third of an ATR clear of the bar) and its switch is folded into the picker as Off. The 50-day damping is always on; its switch is gone, and the undamped sigma stays in the data window. The Show status table switch is folded into the location picker, now titled Status table, as a Hidden entry, which is also the default; a chart that had the switch on keeps its saved location.

Wyłączenie odpowiedzialności

Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.