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.83 — +274.9% total return with a 31.7% worst drawdown across 5,205 trades, net of fees, slippage, and funding.
2024-08-15 → 2026-07-05 · net of fees, slippage, and funding · price-only Sharpe 1.95 · 5,205 trades — the numbers already include that turnover cost.
At $1,000, this strategy’s worst historical dip was about $317. 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=[], resolved_at="")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.
Heads up: high turnover.
At $1,000, these settings' worst historical dip was about $317. You land in the editor with this exact setup. Free account, your own keys.
Compare all 5 settings
| Settings | Sharpe | Return | Worst DD | Trades |
|---|---|---|---|---|
| MACD 12/26/9 · tf 4h · Universe 15default | 1.83 | 274.9% | −31.7% | 5,205 |
| MACD 8/17/9 · tf 4h · Universe 15 | 1.65 | 214.9% | −32.3% | 5,168 |
| MACD 12/26/9 · tf 4h · Universe 25 | 1.20 | 163.9% | −48.9% | 9,500 |
| MACD 12/26/9 · tf 4h · Universe 8 | 1.05 | 64.5% | −29.7% | 2,889 |
| MACD 12/26/9 · tf 1d · Universe 15 | -0.10 | -13.1% | −38.9% | 438 |
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 | -7.2% |
| 2025-04 | +9.8% |
| 2025-05 | +4.5% |
| 2025-06 | +2.8% |
| 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 | -1.3% |
| 2026-04 | -6.8% |
| 2026-05 | +29.8% |
| 2026-06 | -15.7% |
| 2026-07 | +4.2% |
Which assets it traded
| Avg allocation | Days held | % of time held | Asset |
|---|---|---|---|
| 0.1766 | 1001 | 24.21 | HYPE |
| 0.1664 | 994 | 24.04 | BTC |
| 0.1599 | 956 | 23.13 | LINK |
| 0.1605 | 916 | 22.16 | ETH |
| 0.165 | 859 | 20.78 | XRP |
| 0.1592 | 795 | 19.23 | DOGE |
| 0.159 | 784 | 18.96 | SOL |
| 0.1572 | 747 | 18.07 | SUI |
| 0.1739 | 698 | 16.88 | VVV |
| 0.1547 | 663 | 16.04 | kPEPE |
| 0.177 | 419 | 10.14 | ZEC |
| 0.1617 | 388 | 9.39 | PUMP |
| 0.1713 | 239 | 5.78 | XPL |
| 0.1719 | 185 | 4.48 | 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 31.7% — 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.