Long-Short Decomposition: When the Short Leg Is the Reason Your Strategy Fails the Test
The backtest looked fine at a glance. EMA 20/50, dual-direction trend following, 7 majors, 4 years. Total return +265.8%. Then the t-statistic came back at 1.61 with p = 0.107. Positive, but not significant. A result you cannot defend in front of anyone who knows what a t-stat means.
The usual reaction is to go hunting for parameter tweaks: faster EMA, slower EMA, ATR stops, regime filters. All of that is premature. Before touching parameters, decompose the P&L by direction. It costs twenty lines of code and it usually tells you more than a week of grid search.
In this case it told the whole story:
| Leg | Return | Trades | t-stat |
|---|---|---|---|
| Long-only | +295.7% | 298 | — |
| Short-only | -37.9% | 140 | -1.61 |
| Combined | +265.8% | 438 | 1.61 |
The short leg did not just underperform. It carried the same magnitude of t-statistic as the combined system, with the opposite sign, and it dragged the aggregate from something you could argue about into the noise floor. The short book was not dead weight. It was actively destroying the evidence that the long book worked.
Why Decompose by Direction First
A dual-direction system is two strategies stapled together with a shared parameter set. The entry logic is symmetric on paper — golden cross long, death cross short — but the return distributions on either side of zero are not symmetric at all. Aggregating them hides that asymmetry behind a single equity curve.
Decomposition is the cheapest diagnostic you have. If one leg has a positive expectancy and the other has a negative one, the combined t-stat is a blend of two different processes and means very little. You are not testing "does trend following work." You are testing "does trend following work, averaged over two markets with different structural properties, weighted by trade count." That is a question nobody asked.
The fix is not to re-weight or re-optimize. It is to measure each leg on its own, then decide what the evidence actually supports.
Implementation: Same Engine, Filter by Sign
The key discipline is that you do not write a second backtester for the long-only variant. You run the exact same engine, record every trade with its direction, and slice the trade log afterward. This guarantees the two legs are directly comparable — same fills, same costs, same sizing.
from dataclasses import dataclass
import numpy as np
import pandas as pd
@dataclass
class Trade:
symbol: str
direction: int # +1 long, -1 short
entry_time: pd.Timestamp
exit_time: pd.Timestamp
entry_px: float
exit_px: float
size: float # notional at entry
def trade_pnl(t: Trade, fee_bps: float = 5.0) -> float:
gross = t.direction * (t.exit_px - t.entry_px) / t.entry_px
fees = 2 * fee_bps / 1e4
return t.size * (gross - fees)
def run_engine(prices: dict[str, pd.DataFrame],
fast: int = 20, slow: int = 50) -> list[Trade]:
"""Dual-direction EMA crossover. One position per symbol at a time."""
trades = []
for sym, df in prices.items():
ef = df["close"].ewm(span=fast, adjust=False).mean()
es = df["close"].ewm(span=slow, adjust=False).mean()
state = 0
entry_px = entry_t = None
for ts, f, s, px in zip(df.index, ef, es, df["close"]):
sig = 1 if f > s else -1
if state == 0:
state, entry_px, entry_t = sig, px, ts
elif sig != state:
trades.append(Trade(sym, state, entry_t, ts,
entry_px, px, size=1.0))
state, entry_px, entry_t = sig, px, ts
return trades
Now the decomposition itself. This is the part worth institutionalizing — put it in a shared module so every strategy report includes it by default.
def leg_stats(trades: list[Trade]) -> pd.DataFrame:
rows = []
for leg, sign in [("long", 1), ("short", -1)]:
pnls = [trade_pnl(t) for t in trades if t.direction == sign]
if len(pnls) < 2:
continue
arr = np.array(pnls)
tstat = arr.mean() / (arr.std(ddof=1) / np.sqrt(len(arr)))
rows.append({"leg": leg, "n": len(arr),
"total": arr.sum(), "mean": arr.mean(),
"t": tstat})
allp = np.array([trade_pnl(t) for t in trades])
rows.append({"leg": "combined", "n": len(allp),
"total": allp.sum(), "mean": allp.mean(),
"t": allp.mean() / (allp.std(ddof=1) / np.sqrt(len(allp)))})
return pd.DataFrame(rows).set_index("leg")
Two notes on the statistics. First, per-trade t-stats are not the same as a daily-returns t-stat on the equity curve; they answer slightly different questions. Per-trade is fine for a diagnostic like this, but if you want to publish a number, compute the t-stat on the daily P&L series of each leg and let the trade-level view stay a screening tool. Second, if trades overlap across symbols, the independence assumption behind the t-stat is violated. For 7 majors running the same signal, correlation is high enough that the effective sample is smaller than 438. That makes the combined p = 0.107 optimistic, not pessimistic — another reason the original result never deserved the benefit of the doubt.
For completeness, the long-only variant is not a new engine. It is the same loop with the short branch suppressed:
def run_long_only(prices, fast=20, slow=50):
trades = []
for sym, df in prices.items():
ef = df["close"].ewm(span=fast, adjust=False).mean()
es = df["close"].ewm(span=slow, adjust=False).mean()
in_pos, entry_px, entry_t = False, None, None
for ts, f, s, px in zip(df.index, ef, es, df["close"]):
if not in_pos and f > s: # golden cross enters
in_pos, entry_px, entry_t = True, px, ts
elif in_pos and f < s: # death cross exits, no reverse
trades.append(Trade(sym, 1, entry_t, ts, entry_px, px, 1.0))
in_pos = False
return trades
Golden cross enters, death cross exits, flat in between. No reverse, no short. The trade count drops from 438 to 298 — exactly the long leg of the dual-direction run, which is the check that your filter is doing what you think it is.
Why Shorting a Trend Follower Is Structurally Hard Here
The short leg was not unlucky. It was fighting three structural forces at once, and none of them show up in a parameter sweep.
Upward skew in the underlying. Crypto majors over a four-year window spent most of their time in a positive drift regime. A trend follower's short entries cluster right after a death cross — that is, after a decline has already happened. In a market with positive drift, the expected value of being short immediately after a drawdown is negative even if the signal has some genuine momentum content. You are systematically selling after the move and buying back into the mean reversion.
Wick-heavy pops. Crypto has no circuit breakers and thin books on the way up. Short positions get stopped or squeezed by single-bar wicks that leave no trace on a close-to-close backtest if your fills assume the close. The asymmetry is brutal: a long position caught in a wick-down is a drawdown, a short position caught in a wick-up is often a liquidation event at a price worse than any bar's close. Backtests systematically flatter shorts because they fill at benign prices.
Negative carry. Funding on perpetuals is positive in bullish regimes, which means shorts pay to hold. Over four years that is a persistent bleed on top of the directional loss. If your backtest does not model funding, your short leg looks better than it is. If it does, the -37.9% is the honest number and it likely understates the real-world drag.
Put together: the short side of a symmetric crossover is short a positively skewed, wick-prone, negative-carry asset class using a signal that enters late. That is not a parameter problem. No combination of 15/60 or 25/80 fixes the structure. This is why the correct response to a failing leg is usually deletion, not repair — the search space for "repair" is mostly overfitting in disguise.
The Discipline of Shipping Only What Passes
Deleting the short leg raised the return to +295.7% on 298 trades. It did not raise the t-statistic into significance. Long-only is still positive-but-not-significant, and pretending otherwise would be the same mistake in a new costume.
So the label on the dashboard changed. The strategy is not promoted to live. It is downgraded to observation tier: a paper-trading observer that runs the long-only logic, logs every signal, and reports the same statistics on a rolling basis until the evidence accumulates. The dashboard text says exactly that — no green badge, no "live" tag, just the numbers and the tier.
The rule that makes this work is mechanical, not judgment-based:
def tier(t_stat: float, n: int, min_n: int = 200) -> str:
if n < min_n:
return "observation" # not enough evidence either way
if abs(t_stat) >= 2.0:
return "live-eligible"
if t_stat > 0:
return "observation" # positive but unproven
return "retired"
def dashboard_row(leg: str, stats: pd.Series) -> dict:
return {
"leg": leg,
"n": int(stats["n"]),
"total_pct": round(100 * stats["total"], 1),
"t": round(float(stats["t"]), 2),
"tier": tier(float(stats["t"]), int(stats["n"])),
"note": "positive but not significant" if stats["t"] < 2 and stats["t"] > 0 else "",
}
Three properties matter here. The threshold is pre-registered, so you cannot move the goalposts after seeing the result. The tier is a pure function of the stats, so the dashboard cannot disagree with the data. And "observation" is a real state with real work attached — the observer keeps logging, and the strategy can only graduate by accumulating evidence, not by someone deciding it feels ready.
Parking the short leg as a paper observer rather than deleting it entirely is the second half of the discipline. You keep the measurement running at zero cost. If the regime shifts — funding flips persistently negative, or the market develops sustained downtrends — the short leg's stats will show it, and you will have four more years of honest data instead of a hunch. What you do not do is force it live because the long book needed a hedge, or because a symmetric strategy looks more elegant in a slide.
What Actually Changed
The final state: one engine, two legs measured separately, one leg deleted from live consideration, the survivor labeled honestly as unproven and parked in observation tier. The headline number went from +265.8% with a misleading aggregate t-stat to +295.7% with a clear statement that it is still not significant.
That is a worse-looking result than the original backtest and a much better one to build on. The decomposition did not find alpha. It found the reason the alpha was invisible, and then it refused to pretend the remainder was more than it was.
More notes like this ship every week on this site.
Daily Picks
The following pairs are selected from the multi-timeframe trend scanner (Gate.io futures) and are for technical-analysis study only — not investment advice.
Data updated: 2026-11-17 08:46:11
Long
| Pair | Signal | Price | Take Profit | Stop Loss | R/R |
|---|---|---|---|---|---|
| LIT | 高质量标的做多 | $2.951 | $3.1458 | $2.8536 | 1:2.0 |
1 picks selected. Scanner runs every 15 minutes.
Top comments (0)