MACD Crossover Strategy (Crypto)
Does a MACD crossover strategy work on crypto? Backtested on real Hyperliquid perps from 2024-08-15 to 2026-07-05, the default settings earned a Sharpe of 1.77 — +260.2% total return with a 33.4% worst drawdown across 5,265 trades, net of fees, slippage, and funding.
2024-08-15 → 2026-07-05 · net of fees, slippage, and funding · price-only Sharpe 1.90 · 5,265 trades — the numbers already include that turnover cost.
At $1,000, this strategy’s worst historical dip was about $334. 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-07-05 the default four-hour settings returned +274.9% with a Sharpe of 1.83 and a maximum drawdown of −31.7%, 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 −31.7% maximum. At 5,205 trades over the window, turnover is meaningful, so fees matter.
How it’s built
The exact strategy behind this backtest — no black box. Switch to code to see or copy the full definition.
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="every_bar")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(timeframe="15min"), TargetTimeframeResampler(), { "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"), ], }, PositionStateMachine(entry_slot="macd_entry", exit_slot="macd_exit"), 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.
Heads up: high_turnover.
At $1,000, these settings' worst historical dip was about $334. You land in the editor with this exact setup. Free account, your own keys.
Compare all 16 settings
| Settings | Sharpe | Return | Worst DD | Trades |
|---|---|---|---|---|
| MACD 8/17/9 · Signal 4h · Pinned top8_launch | 0.96 | 54.6% | −24.8% | 2,910 |
| MACD 8/17/9 · Signal 4h · Pinned top15_launch | 1.78 | 250.7% | −32.9% | 5,197 |
| MACD 8/17/9 · Signal 1d · Pinned top8_launch | -0.25 | -11.8% | −28.4% | 255 |
| MACD 8/17/9 · Signal 1d · Pinned top15_launch | -0.17 | -16.9% | −36.7% | 459 |
| MACD 12/26/9 · Signal 4h · Pinned top8_launch | 1.08 | 67.5% | −27.9% | 2,927 |
| MACD 12/26/9 · Signal 4h · Pinned top15_launchdefault | 1.77 | 260.2% | −33.4% | 5,265 |
| MACD 12/26/9 · Signal 1d · Pinned top8_launch | -1.25 | -34.5% | −35.6% | 229 |
| MACD 12/26/9 · Signal 1d · Pinned top15_launch | -0.58 | -33.9% | −46.4% | 422 |
| MACD 19/39/9 · Signal 4h · Pinned top8_launch | 0.96 | 59.9% | −28.7% | 3,102 |
| MACD 19/39/9 · Signal 4h · Pinned top15_launch | 1.41 | 172.1% | −30.0% | 5,493 |
| MACD 19/39/9 · Signal 1d · Pinned top8_launch | -0.19 | -7.9% | −33.0% | 235 |
| MACD 19/39/9 · Signal 1d · Pinned top15_launch | 0.16 | 0.6% | −46.1% | 434 |
| MACD 24/52/18 · Signal 4h · Pinned top8_launch | 0.67 | 36.6% | −28.1% | 3,197 |
| MACD 24/52/18 · Signal 4h · Pinned top15_launch | 1.04 | 105.5% | −39.0% | 5,812 |
| MACD 24/52/18 · Signal 1d · Pinned top8_launch | -0.45 | -15.3% | −27.4% | 242 |
| MACD 24/52/18 · Signal 1d · Pinned top15_launch | 0.07 | -4.4% | −38.8% | 453 |
The data
Monthly returns
| Month | Return |
|---|---|
| 2024-08 | 0.0% |
| 2024-09 | +10.6% |
| 2024-10 | +5.5% |
| 2024-11 | +70.4% |
| 2024-12 | -5.7% |
| 2025-01 | -3.4% |
| 2025-02 | -6.0% |
| 2025-03 | -9.6% |
| 2025-04 | +9.9% |
| 2025-05 | +5.3% |
| 2025-06 | +1.4% |
| 2025-07 | +7.6% |
| 2025-08 | -0.4% |
| 2025-09 | +28.7% |
| 2025-10 | -3.1% |
| 2025-11 | -2.7% |
| 2025-12 | +3.3% |
| 2026-01 | +29.9% |
| 2026-02 | +9.9% |
| 2026-03 | -0.0% |
| 2026-04 | -8.5% |
| 2026-05 | +29.6% |
| 2026-06 | -15.7% |
| 2026-07 | +4.2% |
Which assets it traded
| Avg allocation | Days held | % of time held | Asset |
|---|---|---|---|
| 0.1755 | 1022 | 24.72 | HYPE |
| 0.1662 | 1006 | 24.33 | BTC |
| 0.1598 | 955 | 23.1 | LINK |
| 0.1604 | 914 | 22.11 | ETH |
| 0.1651 | 868 | 21 | XRP |
| 0.1592 | 805 | 19.47 | DOGE |
| 0.1596 | 800 | 19.35 | SOL |
| 0.1571 | 749 | 18.12 | SUI |
| 0.1736 | 691 | 16.72 | VVV |
| 0.1545 | 668 | 16.16 | kPEPE |
| 0.1766 | 419 | 10.14 | ZEC |
| 0.1623 | 380 | 9.19 | PUMP |
| 0.1712 | 238 | 5.76 | XPL |
| 0.1704 | 187 | 4.52 | LIT |
| 0 | 0 | 0 | GRAM |
What this is: a historical backtest on real Hyperliquid market data, net of fees, slippage, and funding. Its worst historical drawdown was 33.4% — 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.