> ## Documentation Index
> Fetch the complete documentation index at: https://docs.askfutures.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Spread z-score, COT and correlation

> Build an advanced ES trade gated by an ES-NQ spread z-score, weekly Commitment-of-Traders positioning, and a rolling correlation filter.

This is the deep end. You'll trade **ES** — but only when the *relationship*
between ES and NQ is stretched, the big commercial players agree, and the two
markets are still moving together. You fade a statistical stretch in that
relationship, and take the trade in one liquid leg.

It pulls together four advanced ideas at once. If z-scores or
Commitment-of-Traders data are new to you, read [signals &
indicators](/concepts/signals-indicators-series) and the [trend-pullback
tutorial](/tutorials/trend-pullback-adaptive-risk) first.

<Info>
  **You'll learn:** using the **ES-NQ spread** as a signal, a **20-bar z-score**
  reversion trigger, a **weekly COT** positioning bias, a **30-bar rolling
  correlation** gate, trading **ES outright**, and exits at the mean or a dollar
  stop. **Time:** about fifteen minutes.
</Info>

## The idea, in plain English

Four conditions working together to time an ES trade:

* **The instrument** — you trade **ES outright**, one market.
* **The signal** — the **ES minus NQ spread**, tracked as a single series so you
  can measure how stretched the relationship is.
* **The trigger** — when the spread's **20-bar z-score climbs above +2**, ES is
  unusually rich versus NQ, so **short ES**, betting the stretch snaps back.
* **The bias** — only when **commercials are net short ES** in the weekly
  [Commitment-of-Traders](/concepts/where-data-comes-from) report (the hedgers'
  positioning agrees with the fade).
* **The gate** — only when the two markets' **30-bar rolling correlation is above
  0.8** (they're moving together tightly enough for the spread signal to mean
  something).
* **The exits** — **cover when the z-score returns to 0** **or** on a **\$1,000
  stop**.

<Note>
  **Why trade ES alone, not the two-leg spread?** A spread built from two
  *different* markets (ES and NQ) can't be traded as a single instrument here —
  the engine trades **same-root** calendar spreads only (e.g. two CL contract
  months). So you use the ES-NQ spread purely as a **signal** and express the
  trade in one liquid leg, ES. You still fade the same stretch — you just place
  one order instead of two.
</Note>

## Step 1 — Describe it

Type it as one connected idea. AskFutures handles the spread construction, the
z-score window, the weekly COT lookup, and the correlation gate from this single
description:

> Trade ES. When the ES-NQ spread's 20-bar z-score exceeds +2 and commercials are
> net short ES in the weekly COT, short ES; cover when the z-score returns to 0 or
> on a \$1,000 stop. Only when the 30-bar rolling correlation between ES and NQ is
> above 0.8.

<Tip>
  A spread-signal reversion behaves differently from a single-market breakout —
  there's no opening-range or intraday-session breakout to lean on. State your
  exits explicitly (mean and dollar stop, as above) so AskFutures doesn't fall
  back to a default it has to guess at.
</Tip>

## Step 2 — Read the strategy card

There's a lot packed into this one. Walk the card top to bottom and confirm each
piece.

<Steps>
  <Step title="Markets">
    One market is **traded** — **ES**. NQ is only *read* (never traded) to build
    the ES-NQ spread signal and the correlation gate, and ES COT is read for the
    positioning bias. See [futures & symbols](/concepts/futures-and-symbols).
  </Step>

  <Step title="The spread signal">
    `ES - NQ`, built as a single series the z-score is measured on. This is the
    **signal** that times your ES trade — not an instrument you trade directly.
  </Step>

  <Step title="Entry trigger">
    **Short ES when the spread's 20-bar z-score is above +2** — two standard
    deviations rich versus its own recent average.
  </Step>

  <Step title="COT bias filter">
    **Commercials net short ES** in the weekly report. COT is a `1w` source, so the
    weekly positioning is held constant across the bars inside that week. See
    [where data comes from](/concepts/where-data-comes-from).
  </Step>

  <Step title="Correlation gate">
    **30-bar rolling correlation between ES and NQ above 0.8.** When the two
    decouple, the spread stops mean-reverting reliably — so the gate stands the
    strategy down.
  </Step>

  <Step title="Exits">
    **Cover ES at the mean** (z-score returns toward 0) **or** a **\$1,000 stop** —
    whichever comes first. See [risk & trade
    management](/concepts/risk-and-trade-management).
  </Step>
</Steps>

The **Strategy Flow** chart makes the gating order clear:

```mermaid theme={null}
flowchart TD
  COR{"ES-NQ 30-bar<br/>correlation &gt; 0.8?"} -->|no| W["Stand aside"]
  COR -->|yes| Z{"Spread 20-bar<br/>z-score &gt; +2?"}
  Z -->|no| W
  Z -->|yes| COT{"Commercials<br/>net short ES?"}
  COT -->|no| W
  COT -->|yes| SH["Short ES"]
  SH --> X{"First to hit?"}
  X -->|"z-score to mean"| M["Cover at mean"]
  X -->|"-$1,000"| ST["Stop"]
```

<Warning>
  COT data is **weekly and reported with a lag** — the published positioning
  reflects a snapshot from earlier in the week, not the live tape. Treat it as a
  slow-moving bias, not a precise timing tool. Check the **Assumptions** notes on
  the card for exactly how the weekly series is aligned to your bars.
</Warning>

## Step 3 — Backtest and read the results

> Backtest it.

With four conditions stacked — and one of them a slow weekly COT bias — expect a
**small number of trades**. That's expected for a selective reversion strategy;
the filters are doing exactly what you asked.

<Warning>
  Backtest results are **hypothetical and simulated**. No real trades were placed,
  so live outcomes can differ. Reported P\&L is net of modeled slippage (default
  **1 tick per round-turn trade**) and commission (default **\$2.50/side** for
  full-size contracts like ES). Past performance — actual or simulated — does not
  guarantee future results. Always test before you trade.
</Warning>

What to check, in order:

<AccordionGroup>
  <Accordion title="Did it trade at all?" icon="hashtag">
    Four filters can leave you with very few — or zero — trades. If it's too
    sparse to judge, relax one gate (correlation above 0.7, or z-score above 1.5)
    and re-run.
  </Accordion>

  <Accordion title="Mean vs stop exits" icon="door-open">
    Mostly `cover at mean` exits is the shape you're hoping for — stretches that
    snapped back. A run of `stop` exits suggests ES kept running rich versus NQ,
    often a sign the correlation gate let through a regime that was actually
    breaking down.
  </Accordion>

  <Accordion title="Did the COT bias help?" icon="scale-balanced">
    Compare against a version with the COT filter removed (next step) to see
    whether the positioning bias actually earned its place.
  </Accordion>
</AccordionGroup>

## Step 4 — Iterate

Change one condition at a time and [compare versions](/guides/version-and-compare)
to isolate what each filter contributes.

> Remove the COT filter and backtest again.

> Loosen the correlation gate to 0.7.

> Use a z-score threshold of +1.5 instead of +2.

> Also take the long side: buy ES when the z-score drops below -2.

> Optimize the z-score threshold and the correlation gate.

Handing the z-score level and correlation threshold to the
[optimizer](/guides/optimize-a-strategy) is the natural way to map out which
combinations would have held up — without running each one by hand.

<Warning>
  This example is **illustrative, not a recommendation**. It exists to exercise an
  ES-NQ spread signal, a z-score trigger, a weekly COT bias, a rolling-correlation
  gate, and dollar-stop exits all at once — not because this exact combination is
  profitable. Use it to learn the mechanics, then build and test your own ideas.
</Warning>

## Next steps

<CardGroup cols={2}>
  <Card title="Where data comes from" icon="database" href="/concepts/where-data-comes-from">
    How COT, correlation, and continuous-contract data are sourced and aligned.
  </Card>

  <Card title="Signals & indicators" icon="wave-square" href="/concepts/signals-indicators-series">
    Z-score, rolling correlation, and the spread builder explained.
  </Card>

  <Card title="Version & compare" icon="code-compare" href="/guides/version-and-compare">
    Run the strategy with and without each filter, side by side.
  </Card>

  <Card title="Is the backtest real?" icon="shield-check" href="/concepts/is-the-backtest-real">
    Why even a complex strategy produces the same numbers every time.
  </Card>
</CardGroup>
