MA Crossover with a Trailing Stop (Crypto)
Does a moving average crossover with a trailing stop work on crypto? Backtested on real Hyperliquid perps from 2024-08-15 to 2026-12-01, the default settings earned a Sharpe of 1.4 — +23.2% total return with a 4.8% worst drawdown across 119 trades in 119 positions, net of fees, slippage, and funding.
2024-08-15 → 2026-12-01 · net of fees, slippage, and funding · price-only Sharpe 1.48 · these are the default settings, not a hand-picked best case.
At $1,000, this strategy’s worst historical dip was about $48. Free account, your own Hyperliquid keys. Keel only trades.
How it works
This is a moving average crossover with a trailing stop. It is adapted from a published system and differs from it in one way that changes how trades end, so that difference comes first.
In the source, only the stop closes a trade. Here a trade ends at its stop or at the opposite signal, whichever comes first: when the averages cross the other way, the position flips from long to short or from short to long. On Keel a trade always flips on an opposite entry, so this version cannot hold a long through a bearish cross and wait for the stop. With these settings the averages often cross back before the stop is reached, and many trades end on a flip. The results on this page are for the flipping version. They are not a test of the source system.
To open: for each coin the strategy compares the 16-day simple moving average of the daily close with the 64-day one. If the fast average is above the slow one it buys. If it is below it goes short.
The stop: at entry the strategy notes the coin's volatility, measured over the last 25 days and expressed as a yearly figure in price terms, and sets the stop distance at half of it. The stop follows the best close the trade has reached. When price falls back from that level by the stop distance, the trade is closed.
After a stop, the strategy does not open another trade in the same direction until the averages have crossed the other way and back. It opens one in the opposite direction as soon as they cross.
The size is set once, at entry, and held until the trade ends. A more volatile coin gets a smaller position, so that each trade risks about the same amount if its stop is hit. The account's risk target is 12% a year, split equally across the ten coins.
The settings grid moves the stop from a quarter to a full year's volatility, and tries faster and slower averages.
Where the rule comes from
The rule is adapted from the starter system in Robert Carver's Leveraged Trading (Harriman House, 2019), as the author describes it in his public writing: a moving average crossover opens a trade and a trailing stop set from volatility closes it. The 16 and 64 day averages, the stop at half a year's volatility, the wait after a stop and the 12% risk target are the settings he gives for it there. Keel built this version from its own public components. It is an adaptation, not the source system, and it is not affiliated with or endorsed by the author.
What differs from the source
- An opposite signal flips the position. In the source only the stop closes a trade.
- The source starts with one instrument. This version runs ten coins at once and gives each a tenth of the risk target, with no allowance for the coins not all moving together, so the whole account runs below 12%.
- The stop is checked on the daily close, so a trade can close well past its stop level on a large move.
- Perps trade in fractions, so there is no rounding to whole contracts, and a perp position pays or earns funding.
- No single position may exceed half the account.
- The coins are the most traded Hyperliquid perps on a fixed date, picked with hindsight. The coin list shows the date. The data starts in August 2024.
When it tends to work
Moves that run for weeks. The stop gives a trade room, so it stays in through ordinary pullbacks, and trades are few, so fees are small.
When it tends to struggle
Markets that reverse sharply after a crossover: the trade opens late and gives back ground before the stop or the next cross closes it. Sideways markets cross the averages back and forth, and each cross flips the position.
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
Globals(target_timeframe="1d")Universe(mode="manual", symbols=["BTC", "ETH", "HYPE", "ZEC", "SOL", "NEAR", "XRP", "PUMP", "LIT", "ENA"], market="perp", resolved=["BTC", "ETH", "HYPE", "ZEC", "SOL", "NEAR", "XRP", "PUMP", "LIT", "ENA"], resolved_at="2026-12-01T00:00:00Z")Execution(rebalance="on_change")Pipeline([ PriceDataLoader(), Store("ohlcv"), { "left": [Load("ohlcv"), HistoricalVolatility(window=25)], "right": [Load("ohlcv"), ExtractSeries(series_name="close")], }, SignalProduct(), Scale(by=0.5), Store("stop_gap"), Load("ohlcv"), {"fast": [SMA(period=16)], "slow": [SMA(period=64)]}, Crossover(), Store("spread"), { "long_in": [Load("spread"), AboveThresholdFilter(threshold=0.0), Store("long_in")], "short_in": [Load("spread"), BelowThresholdFilter(threshold=0.0), Store("short_in")], }, {"fast": [Load("long_in")], "slow": [Load("short_in")]}, Crossover(), ThresholdCross(upper=0.5, lower=-0.5, mode="symmetric"), Store("entries"), TradeManager(entries="entries", prices="ohlcv"), { "trail": [{"fast": [GiveBack()], "slow": [AtEntry(slot="stop_gap")]}, Crossover(), AboveThresholdFilter(threshold=0.0), Exit()], }, RiskSizer(distance="stop_gap", risk=0.006, max_weight=0.5),], name="ma_crossover_trailing_stop_crypto")Explore the settings
precomputed · updates instantlyAdjust a setting to see the exact backtested result, including the ones that lost money.
Complete 12-cell public cross-product on explicit resolved universes.
At $1,000, these settings' worst historical dip was about $48. You land in the editor with this exact setup. Free account, your own keys.
Compare all 12 settings
| Stop distance (share of annual volatility) | Moving averages (fast/slow days) | Sharpe | Return | Worst DD | Trades |
|---|---|---|---|---|---|
| 0.25 | 8_32 | 0.69 | 9.3% | −8.5% | 260 |
| 0.25 | 16_64 | 1.95 | 25.1% | −3.3% | 119 |
| 0.25 | 32_128 | 0.79 | 5.8% | −2.4% | 62 |
| 0.5 | 8_32 | 1.11 | 19.7% | −9.2% | 260 |
| 0.5 | 16_64default | 1.40 | 23.2% | −4.8% | 119 |
| 0.5 | 32_128 | 0.19 | 1.7% | −4.4% | 62 |
| 0.75 | 8_32 | 1.01 | 18.0% | −8.8% | 260 |
| 0.75 | 16_64 | 1.40 | 25.9% | −5.1% | 119 |
| 0.75 | 32_128 | 0.12 | 1.2% | −6.7% | 62 |
| 1 | 8_32 | 1.01 | 18.1% | −8.8% | 260 |
| 1 | 16_64 | 1.31 | 24.4% | −6.1% | 119 |
| 1 | 32_128 | -0.04 | -0.9% | −8.1% | 62 |
The data
Monthly returns
| Month | Return |
|---|---|
| 2024-08 | 0.0% |
| 2024-09 | 0.0% |
| 2024-10 | +0.2% |
| 2024-11 | +5.0% |
| 2024-12 | +0.3% |
| 2025-01 | -0.6% |
| 2025-02 | +1.8% |
| 2025-03 | +1.1% |
| 2025-04 | -0.9% |
| 2025-05 | +0.1% |
| 2025-06 | +1.0% |
| 2025-07 | -0.4% |
| 2025-08 | +0.1% |
| 2025-09 | -2.0% |
| 2025-10 | -0.5% |
| 2025-11 | +1.5% |
| 2025-12 | +0.7% |
| 2026-01 | -2.2% |
| 2026-02 | +2.1% |
| 2026-03 | +0.2% |
| 2026-04 | -0.3% |
| 2026-05 | +0.2% |
| 2026-06 | +2.0% |
| 2026-07 | -1.2% |
| 2026-08 | +5.0% |
| 2026-09 | +3.9% |
| 2026-10 | -1.1% |
| 2026-11 | +5.5% |
| 2026-12 | -0.3% |
Which assets it traded
| Avg allocation | Days held | % of time held | Asset |
|---|---|---|---|
| 0.002 | 757 | 90.33 | BTC |
| -0.0021 | 748 | 89.26 | ETH |
| -0.0037 | 699 | 83.41 | ENA |
| -0.0014 | 690 | 82.34 | SOL |
| -0.0105 | 669 | 79.83 | XRP |
| 0.0005 | 650 | 77.57 | HYPE |
| -0.0011 | 638 | 76.13 | NEAR |
| -0.0032 | 393 | 46.9 | PUMP |
| -0.0006 | 338 | 40.33 | ZEC |
| -0.0011 | 253 | 30.19 | LIT |
What this is: a historical backtest on real Hyperliquid market data, net of fees, slippage, and funding. Its worst historical drawdown was 4.8%. 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.