Noon Barbari
Registrarse
Todos los artículos
tutorialPublicado ·7 min de lectura

How to backtest a moving average crossover on crypto

The golden cross is the most famous trading signal there is — and most people have never actually tested it. Here's how to backtest a moving average crossover properly.

En esta página

A fast moving average crosses above a slow one — the "golden cross" — and the internet calls it bullish. The opposite cross, the "death cross," is supposedly bearish. These are the most repeated signals in trading and among the least tested by the people repeating them. A moving average crossover is genuinely useful as a trend filter, and genuinely mediocre as a standalone signal. A backtest tells you which one you've actually built.

Step 1: define the crossover precisely

State three things: which two averages, what type, and what happens on each cross. A common version is a 50-period and a 200-period simple moving average — go long when the 50 crosses above the 200, flat when it crosses below. You could use EMAs instead of SMAs (faster to react, more whipsaw), or different periods. Every one of those choices changes the result, so write them down before testing rather than after seeing what worked.

Be clear about what the strategy does between crosses, too. Is it always in the market (long after a golden cross, flat or short after a death cross), or does it also use a stop? "Always in" crossover systems have huge drawdowns; that has to be a deliberate choice, and your backtest is where you see the size of it.

Step 2: test across regimes, not just a bull run

Crossover systems are trend-following, so they shine in long trends and suffer in ranges, where price oscillates across the averages and triggers cross after losing cross. If you only backtest a moving average crossover over a single sustained bull market, you'll conclude it's brilliant. Include a chop phase and a bear leg and you'll see the whipsaw losses that the trends have to pay for. The honest number is the one measured across all three.

Step 3: judge it on drawdown and consistency

Look past total return to maximum drawdown — "always in" crossover systems routinely sit through 40-50% equity falls, which most people cannot actually hold through. Then read the Sharpe ratio for risk-adjusted return and the trade count for statistical weight. A handful of trades over years means the result rests on luck, however good the curve looks.

rules.yaml — 50/200 SMA crossover with an ATR stop
strategy:
  name: ma_crossover
  indicators:
    - { id: fast, kind: SMA, period: 50 }
    - { id: slow, kind: SMA, period: 200 }
  rules:
    entry:
      all:
        - { type: crosses_above, left: fast, right: slow }
    exit:
      any:
        - { type: crosses_below, left: fast, right: slow }
  risk:
    size_pct: 1.0
    stop_loss_atr: 3.0

Step 4: choose the periods without overfitting them

The 50 and 200 are conventions; nothing says they're optimal for crypto. The temptation is to sweep every fast/slow combination and keep the pair that maximised past returns — which is textbook overfitting. If 48/210 backtests beautifully while 50/200 and 45/205 fall apart, you've found noise, not a parameter. Use walk-forward optimization so the periods are chosen on data the optimizer hasn't seen. A crossover that survives walk-forward is a real trend filter; one that doesn't was a curve drawn through the past.

Build it without code

In Noon Barbari, SMA and EMA are built-in indicators, and the visual strategy designer expresses the crossover, exit, and stop in a few clicks. Backtest it across years of crypto history, then walk-forward the periods to see whether they're real. The free tier covers one strategy end to end.

Pruébalo con tus datos

Cada concepto de arriba está implementado en la plataforma. Backtest, walk-forward, paper trading, luego live — el mismo conjunto de reglas en cada etapa.

Lecturas relacionadas

Guías relacionadas

Términos clave