MACD Crossover Strategy (Crypto)
Does a MACD crossover strategy work on crypto? Backtested on real Hyperliquid perps from 2024-08-15 to 2026-09-29, the default settings earned a Sharpe of 1.87 — +408.8% total return with a 33.3% worst drawdown across 2,746 trades in 1,142 positions, net of fees, slippage, and funding.
2024-08-15 → 2026-09-29 · net of fees, slippage, and funding · price-only Sharpe 2.00 · these are the default settings, not a hand-picked best case.
At $1,000, this strategy’s worst historical dip was about $333. Free account, your own Hyperliquid keys. Keel only trades.
How it works
How it works
This strategy trades the top-15 Hyperliquid perpetuals on four-hour bars. It goes long a coin when its MACD histogram (12/26/9) turns positive — a confirmed shift in momentum — and its price is above its 200-bar average, which keeps entries on the trending side. Otherwise it holds cash. Positions are equal-weight, 1x gross, long-or-flat, and it trades only when a position drifts 20% from target.
When it works best
Sustained, multi-day trends — exactly the legs the four-hour timeframe is quick enough to catch. The timeframe is the whole edge here: the identical rules run on daily bars barely break even, because by the time a daily MACD confirms, crypto's move is largely over. The MACD periods themselves make little difference. Over 2024-08-15 to 2026-09-29 the default four-hour settings returned +408.8% with a Sharpe of 1.87 and a maximum drawdown of −33.3%, net of fees, slippage, and funding.
When it struggles
Choppy, directionless markets, where the trend filter flips on and off and each entry gives back a little. It is long-or-flat, so it sits out downtrends rather than profiting from them, and drawdowns can run deep — the test window saw a −33.3% maximum. At 2,746 trades over the window, turnover is meaningful, so fees matter.
How it’s built
The exact strategy behind this backtest, with no black box. Fork it to change it and run your own backtest.
Configuration
Factories
Globals(target_timeframe="4h")Universe(mode="top_volume", top_n=15, market="perp", resolved=["BTC", "DOGE", "ETH", "GRAM", "HYPE", "LINK", "LIT", "PUMP", "SOL", "SUI", "VVV", "XPL", "XRP", "ZEC", "kPEPE"], resolved_at="2026-07-06T20:36:37.412320+00:00")Execution(rebalance="on_change")trend_vs_200 = Pipeline([ { "px": [EWMA(window=2)], "trend": [EWMA(window=200)], }, Crossover(fast_key="px", slow_key="trend"),], name="trend_vs_200")Pipeline([ PriceDataLoader(), Store("ohlcv"), { "entries": [ Pipeline([ { "const": [ConstantForecast(value=1.0)], "setup": [ Pipeline([ { "macd_up": [MACD(fast_period=12, slow_period=26, signal_period=9), AboveThresholdFilter(threshold=0.0)], "uptrend": [trend_vs_200, AboveThresholdFilter(threshold=0.0)], }, MaskAnd(), ], name="setup"), ], }, ApplyMask(score_signal="const", filter_signal="setup"), Store("macd_entry"), ], name="entries"), ], "exits": [ Pipeline([ { "const": [ConstantForecast(value=1.0)], "cross_down": [MACD(fast_period=12, slow_period=26, signal_period=9), BelowThresholdFilter(threshold=0.0)], }, ApplyMask(score_signal="const", filter_signal="cross_down"), Store("macd_exit"), ], name="exits"), ], }, TradeManager(entries="macd_entry", prices="ohlcv"), { "macd_cross_down": [Load("macd_exit"), Exit()], }, Exposure(), EqualWeightSizer(target_leverage=1.0, max_weight=0.2),], name="macd_crossover_crypto")Explore the settings
precomputed · updates instantlyAdjust a setting to see the exact backtested result, including the ones that lost money.
Complete 16-cell public cross-product on explicit resolved universes.
At $1,000, these settings' worst historical dip was about $333. You land in the editor with this exact setup. Free account, your own keys.
Compare all 16 settings
| MACD periods | Signal timeframe | Pinned universe | Sharpe | Return | Worst DD | Trades |
|---|---|---|---|---|---|---|
| 8/17/9 | 4h | Top 8 coins | 1.36 | 128.4% | −27.3% | 1,020 |
| 8/17/9 | 4h | Top 15 coins | 1.92 | 422.3% | −33.5% | 3,227 |
| 8/17/9 | 1d | Top 8 coins | 0.41 | 15.7% | −30.1% | 89 |
| 8/17/9 | 1d | Top 15 coins | 0.42 | 19.8% | −38.1% | 256 |
| 12/26/9 | 4h | Top 8 coins | 1.18 | 103.7% | −27.5% | 798 |
| 12/26/9 | 4h | Top 15 coinsdefault | 1.87 | 408.8% | −33.3% | 2,746 |
| 12/26/9 | 1d | Top 8 coins | 0.22 | 5.3% | −37.4% | 92 |
| 12/26/9 | 1d | Top 15 coins | 0.48 | 25.8% | −46.9% | 248 |
| 19/39/9 | 4h | Top 8 coins | 1.05 | 89.0% | −32.5% | 698 |
| 19/39/9 | 4h | Top 15 coins | 1.61 | 295.7% | −33.7% | 2,314 |
| 19/39/9 | 1d | Top 8 coins | 0.52 | 21.1% | −36.2% | 68 |
| 19/39/9 | 1d | Top 15 coins | 0.92 | 73.6% | −47.8% | 187 |
| 24/52/18 | 4h | Top 8 coins | 0.84 | 64.7% | −29.4% | 536 |
| 24/52/18 | 4h | Top 15 coins | 1.17 | 165.3% | −40.4% | 1,848 |
| 24/52/18 | 1d | Top 8 coins | 0.42 | 15.8% | −31.1% | 46 |
| 24/52/18 | 1d | Top 15 coins | 0.81 | 63.2% | −39.6% | 151 |
The data
Monthly returns
| Month | Return |
|---|---|
| 2024-08 | 0.0% |
| 2024-09 | +14.5% |
| 2024-10 | +6.0% |
| 2024-11 | +72.2% |
| 2024-12 | -9.7% |
| 2025-01 | -1.1% |
| 2025-02 | -5.1% |
| 2025-03 | -9.3% |
| 2025-04 | +11.7% |
| 2025-05 | +3.4% |
| 2025-06 | +1.1% |
| 2025-07 | +6.9% |
| 2025-08 | -1.5% |
| 2025-09 | +29.4% |
| 2025-10 | -3.4% |
| 2025-11 | -2.5% |
| 2025-12 | +3.2% |
| 2026-01 | +30.9% |
| 2026-02 | +10.9% |
| 2026-03 | -0.8% |
| 2026-04 | -4.2% |
| 2026-05 | +26.6% |
| 2026-06 | -12.0% |
| 2026-07 | -6.0% |
| 2026-08 | +20.8% |
| 2026-09 | +17.2% |
Which assets it traded
| Avg allocation | Days held | % of time held | Asset |
|---|---|---|---|
| 0.1573 | 1242 | 26.71 | BTC |
| 0.1532 | 1219 | 26.22 | LINK |
| 0.1677 | 1166 | 25.08 | HYPE |
| 0.1528 | 1158 | 24.9 | ETH |
| 0.1507 | 1096 | 23.57 | SOL |
| 0.1559 | 997 | 21.44 | XRP |
| 0.1493 | 973 | 20.92 | SUI |
| 0.1498 | 966 | 20.77 | DOGE |
| 0.1474 | 930 | 20 | kPEPE |
| 0.1659 | 852 | 18.32 | VVV |
| 0.165 | 626 | 13.46 | ZEC |
| 0.1546 | 605 | 13.01 | PUMP |
| 0.1609 | 444 | 9.55 | LIT |
| 0.1574 | 348 | 7.48 | XPL |
| 0.1268 | 69 | 1.48 | GRAM |
What this is: a historical backtest on real Hyperliquid market data, net of fees, slippage, and funding. Its worst historical drawdown was 33.3%. Expect drawdowns of that order or worse. Past performance does not predict future results, and this is not investment advice. Size your account so a full drawdown is survivable.