Xem Tiếng Việt
Chương 3Original (EN)

Chapter 3: Intramarket Indicator Differences (Cross-Asset Momentum in Python)


Chapter Overview — 00:00

Highly correlated assets tend to move together in broad market tides. For example, between 2018 and 2023, the correlation between the hourly log returns of Bitcoin (BTC) and Ethereum (ETH) stood at an astounding 0.84. While co-movement is expected, alpha often hides in the brief windows where one asset diverges from its peer.

This chapter explores intramarket differencing—one of the simplest multi-symbol quantitative techniques:

  1. The Stationarity & Normalization Problem: Why raw indicator differences fail when assets trade at drastically different price scales and volatility levels.
  2. The Normalized Close-Minus-Moving-Average (CMMA) Indicator: Engineering a stationary indicator scaled by Average True Range (ATR) and the square root of the lookback period (N\sqrt{N}).
  3. Relative Momentum Trading Strategy: Exploiting the tendency of crypto outperformance to persist, entering on divergence thresholds and exiting upon equilibrium reversion.
  4. Parameter Robustness & Extensions: Evaluating performance over 5 years of hourly data across parameter spaces and generalizing the concept to broader cross-sectional universes.

1. The Mechanics of Intramarket Differencing — 00:31

Why Relative Divergence Matters

In a market where the tide lifts or drops all boats, isolated price moves tell an incomplete story. An asset rising 3% when its peer benchmark rises 8% is actually exhibiting relative weakness. Intramarket differencing measures this relative performance by computing the same technical indicator on two correlated symbols and subtracting one from the other:

Difference=IndicatorA−IndicatorB\text{Difference} = \text{Indicator}_A - \text{Indicator}_B

The Normalization Requirement

Any indicator used for differencing must satisfy two statistical properties:

  1. Stationarity: The indicator must fluctuate around a stable mean rather than trending indefinitely.
  2. Identical Scale: The metric must be comparable across symbols regardless of nominal price or inherent volatility.

The Pitfalls of Raw Indicators

Consider the simple indicator (Close−SMA)(\text{Close} - \text{SMA}). It fails across two dimensions:

  • Price Scale Disparity: Bitcoin trading at $30,000 will produce raw deviations 10–20 times larger than Ethereum trading at $2,000, causing BTC's deviations to completely dominate the spread. Even taking logarithmic prices does not resolve the next issue.
  • Volatility Disparity: Different assets have fundamentally different baseline volatilities (e.g., Bitcoin vs. Dogecoin). Without normalization, the higher-beta asset will distort every difference calculation.

2. The Normalized CMMA Indicator — 01:02

Mathematical Formulation

To make (Close−SMA)(\text{Close} - \text{SMA}) comparable across any two assets and across different lookback windows, the deviation is divided by an ATR-based volatility denominator scaled by the square root of the moving average window:

CMMA(N,M)=Close−SMA(N)ATR(M)×N\text{CMMA}(N, M) = \frac{\text{Close} - \text{SMA}(N)}{\text{ATR}(M) \times \sqrt{N}}

Where:

  • NN is the moving average lookback window.
  • MM is the baseline ATR lookback window (set to a wide window, such as 168 hours / 1 week, to reflect general market regime volatility).
  • N\sqrt{N} acts as a scale normalizer derived from random walk properties (in Brownian motion, the expected dispersion of accumulated steps scales with the square root of time). This ensures the metric retains a consistent distribution whether N=12N=12 or N=100N=100.
def cmma(ohlc: pd.DataFrame, lookback: int, atr_lookback: int = 168) -> pd.Series:
    atr = ta.atr(ohlc['high'], ohlc['low'], ohlc['close'], length=atr_lookback)
    sma = ta.sma(ohlc['close'], length=lookback)
    diff = ohlc['close'] - sma
    return diff / (atr * np.sqrt(lookback))

The Intramarket Spread

For Ethereum and Bitcoin, the relative spread is computed as:

ΔETH-BTC=CMMAETH−CMMABTC\Delta_{\text{ETH-BTC}} = \text{CMMA}_{\text{ETH}} - \text{CMMA}_{\text{BTC}}

  • Δ>0\Delta > 0: Ethereum is stretched higher above its moving average than Bitcoin (ETH is outperforming).
  • Δ<0\Delta < 0: Ethereum is lagging behind its moving average relative to Bitcoin (ETH is underperforming).
  • Δ=0\Delta = 0: Equilibrium; both assets are in identical structural positions relative to their moving averages.

3. The Relative Momentum Strategy — 04:10

Strategy Thesis: Momentum Persistence

In cryptocurrency markets, relative strength tends to persist: when an asset begins materially outperforming its primary benchmark, that outperformance frequently continues before mean-reverting.

Execution Rules (Threshold-Revert)

Instead of a mean-reversion bet, the strategy adopts a trend/momentum continuation approach:

  • Long Entry (ETH): When ΔETH-BTC\Delta_{\text{ETH-BTC}} crosses above +θ+\theta (Threshold), enter a Long position on Ethereum.
  • Short Entry (ETH): When ΔETH-BTC\Delta_{\text{ETH-BTC}} crosses below −θ-\theta, enter a Short position on Ethereum.
  • Exit Condition (Reversion to Equilibrium):
    • Exit Long when ΔETH-BTC≤0\Delta_{\text{ETH-BTC}} \le 0.
    • Exit Short when ΔETH-BTC≥0\Delta_{\text{ETH-BTC}} \ge 0.
Spread (Δ)
  ^
  |          +θ  ------------------- [Long Entry]
  |             /                   \
  |  0.0  =====x=====================x=== [Exit Long / Flat]
  |                                   \
  |          -θ  ----------------------x-- [Short Entry]
  v

Setting the Threshold (θ\theta)

Examining the histogram of ΔETH-BTC\Delta_{\text{ETH-BTC}} reveals an approximately normal distribution centered at zero:

  • A high threshold yields sparse, selective trades during extreme divergences.
  • A threshold closer to zero triggers frequent trades on modest relative moves.
  • Setting θ=0.25\theta = 0.25 sits comfortably within the distribution, generating substantial trade samples for validation.

4. Backtest Results & Parameter Robustness — 05:45

Baseline Performance (2018–2023 Hourly Data)

  • Parameters: Moving average lookback N=24N = 24 hours, Threshold θ=0.25\theta = 0.25, ATR lookback M=168M = 168 hours.
  • Trades: Approximately 4,400 completed trades (balanced across longs and shorts).
  • Win Rate: Slightly above 50% for both directions.
  • Profit Factor: 1.08 (gross, excluding trading fees and slippage).

Parameter Space Heatmap

Testing across a wide grid of moving average lookbacks and threshold values demonstrates notable stability:

  • Universal Edge: Nearly every parameter combination across the tested grid achieved a Profit Factor >1.0> 1.0.
  • Sweet Spot: Lower to mid-range moving average lookbacks (N∈[12,48]N \in [12, 48]) paired with thresholds around θ≈0.30\theta \approx 0.30 yielded the strongest risk-adjusted performance.
  • Because profitability is not isolated to an arbitrary spike, the underlying phenomenon represents a genuine market inefficiency rather than curve-fitting.

5. Extensions & Intermarket Analysis — 07:35

Generalizing the Method

  1. Other Oscillators: The same differencing logic applies to bounded oscillators like RSI (RSIETH−RSIBTCRSI_{\text{ETH}} - RSI_{\text{BTC}}), ADX, or normalized MACD histograms.
  2. Cross-Sectional Altcoin Selection: Calculate CMMAAlt−CMMABTC\text{CMMA}_{\text{Alt}} - \text{CMMA}_{\text{BTC}} across 50 liquid altcoins. At each rebalance bar, go long the top 3 strongest performers and short the 3 weakest.
  3. Intramarket vs. Intermarket:
    • Intramarket: Comparing assets within the same asset class (BTC vs. ETH, Pepsi vs. Coke).
    • Intermarket: Comparing cross-asset regimes, such as equity indices vs. government bond yields (e.g., S&P 500 vs. 10-Year Treasuries), to detect macro risk-on / risk-off rotations.

Key Takeaways

  • Correlation hides divergence: High macro correlation (0.840.84) provides the necessary baseline; deviations from this baseline create alpha opportunities.
  • Normalization is essential: Never subtract unscaled price indicators. Always adjust for volatility (ATR\text{ATR}) and lookback time horizon (N\sqrt{N}).
  • Momentum beats premature fading: In crypto, betting that outperformance will continue until returning to the mean is statistically superior to immediately fading the spread.

Nguồn duy nhất: Kênh YouTube chính thức của neurotrader. Nội dung được hệ thống hóa phục vụ học tập & tra cứu — bấm các mốc thời gian trong bài để xem trực tiếp video gốc của tác giả.