Strategy Detail
CL / NG Energy Pair
Trades the CL/NG (crude oil / natural gas) price ratio as a mean-reversion spread. Long the ratio when it stretches low, short when it stretches high, exit on z-score return to neutral.
Sample runs (3)
What It Does
CL / NG Energy Pair runs on daily bars. On every session close where both legs printed, the strategy:
- Computes the closing price ratio
ratio = CL_close / NG_close. - Pulls the prior
lookback_daysdaily ratios (default 60), computes their mean and standard deviation. - Computes today’s z-score:
z = (today_ratio - mean) / stdev. - If flat and
z >= entry_z(default 2.0): short the spread by selling CL and buying NG (the ratio is high relative to history; crude is “rich” vs gas). - If flat and
z <= -entry_z: long the spread by buying CL and selling NG (the ratio is low; crude is “cheap” vs gas). - If in a position and
|z| <= exit_z(default 0.5): flatten both legs.
The strategy has no stops, no profit targets, no holding-period limit. The z-score crossing back through the exit band is the only exit. A spread that keeps stretching against the position is held until it eventually reverts or the backtest ends.
Not a Crack Spread
A textbook crack spread trades crude against refined products (gasoline RB, heating oil HO), capturing the refining margin. That is a separate family. This pair just trades two energy futures against each other on a rolling z-score. The economic linkage is weaker: both legs respond to broad energy demand, but supply is driven by very different fundamentals (oil is global, gas is regional and dominated by US production and weather), so the ratio is noisier and less anchored than a true crack.
Why the Pair Sometimes Reverts
Crude oil and natural gas are loosely correlated because both move with industrial activity, power demand, and weather-linked consumption. When the ratio gets pushed to an extreme by a one-sided shock (a brief gas spike during a cold snap, a transient oil rally on geopolitical news), the relationship often pulls back as the shock fades.
A pair spread isolates the relative move. By design it has less directional exposure than a single-leg energy position: a synchronized rally or sell-off in both legs leaves the spread roughly unchanged. The trade pays off when the relationship reverts, not when energy itself moves.
The flip side, which matters a lot for this pair: oil and gas are not the same asset. Their supply curves and shipping markets are mostly disconnected. When one side gets a structural push (US LNG export ramp lifting domestic gas, sanctions reshaping crude flows), the ratio can move to a new equilibrium and stay there. The strategy does not detect regime breaks; it keeps placing the same trade.
Notional Balance
CL is $1,000 per point. At ~$80, one contract is ~$80k notional. NG is $10,000 per point. At ~$3, one contract is ~$30k notional. The default cl_quantity:ng_quantity of 1:2 brings dollar exposure roughly into balance at 2020-era prices (1 CL ≈ $80k vs 2 NG ≈ $60k). The balance shifts as the underlying prices drift, and the strategy does not auto-rebalance. Users running across very different price regimes may want to adjust the leg sizes.
Presets
Five presets cover the canonical variants:
- Classic Z=2 Both Sides: the default starting point. Trades both directions at 2-stdev entry, 0.5-stdev exit.
- Tight Z=1.5 / Wide Z=2.5: narrower or wider entry bands. Tighter fires more often with more whipsaw; wider fires rarely and may go a long time without a trade.
- Long Spread Only / Short Spread Only: directional variants for when you have a view on which side of the relationship is more reliable.
Best In
- Stretches where the ratio is range-bound and driven by ordinary weather or inventory swings.
- Research where you want a relative-value baseline that is largely insensitive to absolute energy direction.
- Studies on how often loosely linked commodity pairs mean-revert across different lookback windows.
Where It Struggles
- Regime breaks. The 2022 Russia/Ukraine episode lifted natural gas dramatically on European supply fears while oil rallied on a different schedule. The ratio behaved very differently from the 2018-2021 baseline, and a strategy keyed off the older mean kept fighting the new equilibrium.
- The multi-year US LNG export ramp and the post-2015 shale gas glut have both shifted the long-run anchor for NG prices in ways that a 60-day rolling mean cannot catch.
- Funding cost is not modeled. Real spread trades have margin requirements on both legs, and NG margin can spike during volatile gas regimes.
What It Does Not Do
- No stops, no targets, no time-based exit. A spread that never reverts to the exit band stays open.
- No regime detection. The strategy keeps applying the same z-score rule whether the relationship is range-bound or in the middle of a structural break.
- No dynamic leg sizing. The
cl_quantity:ng_quantityratio is fixed per preset and does not adjust as prices drift. - No roll handling. Backtests use whatever continuous front-month series the data files provide; live trading would require an explicit roll rule.
Presets (5)
Named parameter bundles for this family. Pick one to see its parameters and pre-fill the New Backtest form. The form lets you adjust contract, date range, and capital before running.
Preset
Classic Z=2 Both Sides
Enter when the CL/NG ratio crosses 2 stdev from a 60-day rolling mean; exit when it returns to 0.5 stdev. Two-sided.
Preset
Tight Z=1.5 Both Sides
Earlier entry at 1.5 stdev. Fires more often than the classic preset; expect lower win rate per trade and more whipsaw.
Preset
Wide Z=2.5 Both Sides
Only trade extreme dislocations beyond 2.5 stdev. Very rare in the post-2020 regime; expect a handful of trades over multi-year windows.
Preset
Long Spread Only
Only takes long-the-spread setups (long CL, short NG when the ratio is depressed). Useful when you believe gas spikes are temporary.
Preset
Short Spread Only
Only takes short-the-spread setups (short CL, long NG when crude has stretched rich relative to gas).