Noon Barbari
Sign up

Back to strategy library

Trend followingLong only1h4h1d

EMA fast/slow crossover strategy

Catch sustained moves by going long when the fast EMA crosses above the slow EMA.

Thesis

Catch sustained moves by going long when the fast EMA crosses above the slow EMA.

Fits Trend following setups — works best when the underlying market behavior matches the thesis, and breaks down when it doesn't. Pair with the backtester's walk-forward mode before committing real capital.

Long flat periods broken by sharp upward jumps when a sustained trend lines up — and visible drawdowns during ranging markets when the cross fires both ways inside a few bars.

YAML rule-set

Paste this into the Strategy Designer's Text tab, or use the dashboard button above to load it as a template.

name: ema_crossover
weight: 1.0
long_only: true
indicators:
  ema_fast: {kind: ema, period: 12}
  ema_slow: {kind: ema, period: 26}
entry:
  combine: AND
  rules:
    - {lhs: {indicator: ema_fast}, op: crosses_up, rhs: {indicator: ema_slow}}
exit:
  combine: OR
  rules:
    - {lhs: {indicator: ema_fast}, op: crosses_down, rhs: {indicator: ema_slow}}
risk:
  trailing_stop_pct: 0.04
  cooldown_bars: 2

Indicators

  • ema_fastEMA (period 12)

    Exponential moving average over the last 12 closes — a short-term smoother that reacts quickly to new prints.

  • ema_slowEMA (period 26)

    Exponential moving average over the last 26 closes — a slower baseline that captures the broader regime.

Entry conditions

The bot opens a position the bar after every condition below has fired.

  • Enter long the bar after EMA(12) crosses above EMA(26).
  • Cooldown of 2 bars after an exit prevents instant whipsaw re-entries.

Exit conditions

Any of the conditions below will close the position.

  • Close on the down-cross: EMA(12) back below EMA(26).
  • Trailing stop of 4% locks in profits if the cross reverses without a clean down-cross.

Expected behavior

Long flat periods broken by sharp upward jumps when a sustained trend lines up — and visible drawdowns during ranging markets when the cross fires both ways inside a few bars.

Equity-curve character, not a return forecast. Backtests are not promises about live performance.

Try it on your own data

Open the template in the dashboard to backtest it on BTC, ETH, or any CCXT symbol — or copy the YAML into the Strategy Designer to edit it first.

Past behavior on backtests is not a guarantee of future performance. Markets change; rule sets need re-validation. Trade at your own risk.