Stat Arb: TXN / CNH — Strategy by pitachio7712
By pitachio7712
Performance Metrics
- Author: pitachio7712
- Symbol: NASDAQ:TXN
- Timeframe: 4 hours
- Net P&L: +633,836.88 USD (+653.59%)
- Win Rate: 64.7%
- Profit Factor: 1.571
- Max Drawdown: 144,375.21 USD (32.25%)
- Total Trades: 391
Description
What is Statistical Arbitrage?Statistical arbitrage is a quantitative trading approach that exploits temporary divergences in the relationship between two historically correlated assets. Rather than predicting where price will go, it measures how far one asset has moved relative to another — and trades the assumption that the relationship will revert to its mean.This strategy pairs Texas Instruments (TXN) against the Chinese Yuan Offshore Futures (CNH1!) as a benchmark. The connection is structural: TXN derives a significant portion of its revenue from the Chinese semiconductor market. When the CNH weakens sharply relative to TXN's price behavior, or vice versa, a statistical divergence opens — and this strategy trades the reversion.How It WorksStep 1 — Normalized Ratio SpreadBoth assets are normalized against their own 20-bar moving average, converting them to a common scale. The ratio of the two normalized values is then smoothed with a 3-bar EMA. This removes absolute price differences and isolates the relative relationship between the two instruments.Step 2 — Z-ScoreThe smoothed ratio is converted into a Z-score using a 20-bar rolling mean and standard deviation. The Z-score answers one question: how many standard deviations is the current relationship from its historical norm?Step 3 — EntryLong when the Z-score crosses below −2.0 AND RSI(14) is below 50 — TXN is statistically cheap relative to CNH and not in an overbought conditionShort when the Z-score crosses above +2.0 AND RSI(14) is above 50 — TXN is statistically expensive relative to CNH and not in an oversold conditionThe RSI filter acts as a basic price-context confirmation, preventing entries that are divergent on the spread but running hard against price momentum.Step 4 — ExitTake Profit: 3× ATR(14) from entry price, stamped at the moment of entryStop Loss: 8× ATR(14) from entry price, stamped at the moment of entryTrades also close on a flip signal — if the opposite Z-score threshold is hit while in a trade, the position reversesThe asymmetric 8×/3× stop-to-TP ratio is intentional. Mean reversion trades have high win rates but occasionally encounter regime breaks where the relationship stops working. The wide stop allows the spread time to revert without getting stopped out by noise, while the tighter TP locks in gains efficiently once momentum turns.Backtest resultsTotal P&L: +653.65%Max Equity Drawdown: 32.25%Total Trades: 391Profitable Trades: 64.71%Profit Factor: 1.571Beats Buy and Hold!Important NotesThis is a research and educational script. Past performance does not guarantee future resultsThe strategy trades on the 4 Hour Timeframe for best results — the ATR-based exits need room to breatheNo commission or slippage is modelled in the backtest — apply realistic costs for your broker before drawing conclusionsPosition size is set to 50% of equity per trade — adjust to match your own risk toleranceThis is not financial advice