← Back to Home
DEMA Cross Strategy Backtest BTC-USD 54.20% Return With 57.88% Excess Return

DEMA Cross Strategy Backtest BTC-USD 54.20% Return With 57.88% Excess Return

Want the full code behind this test? The Mega Backtrader Strategy Pack includes 500+ Backtrader-ready Python strategies, batch runners, dashboards, CSV metrics, chart exports, and documentation. You can get the full package here: Mega Backtrader Strategy Pack.

Moving-average crossovers are simple, but lag can be expensive. The DEMA Cross strategy uses double exponential moving averages to react faster, and in this BTC-USD run it produced a 54.20% return while buy-and-hold lost 3.69%.

The test used BTC-USD daily candles from July 27, 2024 to July 27, 2026. The benchmark was BTC buy-and-hold over the same period.

Result Value
Strategy return 54.20%
BTC buy-and-hold return -3.69%
Excess return 57.88%
Final portfolio value $15,419.77
Sharpe ratio 0.96
Max drawdown 21.81%
Closed trades 15
Open trades 1
Win rate 46.67%

Why This Strategy Matters

DemaCrossStrategy is a double EMA crossover trend timing strategy.

This is not a complex system, and that is the point. It is a clean trend-following baseline that can be inspected quickly, modified easily, and compared against more advanced systems.

The strategy logic is:

  1. Calculate fast and slow DEMA lines.
  2. Use a crossover indicator to detect trend flips.
  3. Enter long when fast DEMA crosses above slow DEMA.
  4. Exit long when the fast DEMA crosses below slow DEMA.
  5. Size the order from a fixed percentage of available cash.

How The Code Works

The two DEMA lines define the trading signal:

self.dema_fast = bt.indicators.DEMA(self.data_close, period=self.params.fast_dema)
self.dema_slow = bt.indicators.DEMA(self.data_close, period=self.params.slow_dema)

Backtrader's crossover indicator turns those lines into a signal:

self.crossover = bt.indicators.CrossOver(self.dema_fast, self.dema_slow)

A bullish crossover creates the long entry:

if self.crossover > 0:
    cash = self.broker.get_cash()
    size = (cash * self.params.order_percentage) / self.data_close[0]
    self.order = self.buy(size=size)

This is the benefit of packaging the idea as a Backtrader strategy: the indicator setup, signal rules, position management, and output metrics all run through the same repeatable research workflow.

Backtest Setup

Setting Value
Asset BTC-USD
Benchmark BTC-USD
Period 2y
Data window July 27, 2024 to July 27, 2026
Interval 1d
Starting cash $10,000.00
Final value $15,419.77
Strategy file DemaCrossStrategy.py
Strategy class DemaCrossStrategy

Performance Results

Metric Value
Starting portfolio value $10,000.00
Final portfolio value $15,419.77
Strategy return 54.20%
BTC buy-and-hold return -3.69%
Excess return vs BTC buy-hold 57.88%
Sharpe ratio 0.96
Max drawdown 21.81%
Total trades 16
Closed trades 15
Open trades 1
Winning trades 7
Losing trades 8
Win rate 46.67%
Runtime 2.36 seconds

The run ended with 1 open trade, so final equity includes mark-to-market value at the last bar while win rate is calculated from closed trades.

Equity Curve vs Benchmark

DemaCrossStrategy BTC-USD equity curve versus benchmark

The equity curve shows whether the strategy built its return steadily or relied on one isolated jump. Here the comparison is especially useful because BTC buy-and-hold finished negative while the strategy finished strongly positive.

Drawdown vs Benchmark

DemaCrossStrategy BTC-USD drawdown versus benchmark

The drawdown chart shows how much pain the strategy had to absorb during the test. Return alone is not enough; a publishable strategy review needs the drawdown path next to the benchmark.

Rolling Return vs Benchmark

DemaCrossStrategy BTC-USD rolling return versus benchmark

The rolling return chart shows when the strategy gained or lost its edge. This helps separate one lucky ending from a result that developed across the test window.

Daily Return Distribution

DemaCrossStrategy BTC-USD daily returns histogram

The daily return distribution excludes zero-return strategy days. In this run, 368 flat strategy-equity days were removed, leaving 362 non-zero strategy return days plotted.

What Traders Can Learn From This Test

The main lesson is not that one backtest is automatically tradable. The lesson is that the research workflow matters. A useful strategy package should let you move from idea, to code, to batch test, to metrics, to charts, to publishable research without rebuilding the same infrastructure over and over.

That is exactly what the Mega Backtrader Strategy Pack is designed to do. It gives you hundreds of ready-to-run strategy modules plus the tooling to test them across assets and time windows.

Get the full package here: Mega Backtrader Strategy Pack.

Disclaimer

This article is for research and educational use only. Backtest results are not financial advice, investment advice, or a guarantee of future performance. Always validate strategy logic, data quality, execution assumptions, costs, slippage, and risk before using any trading system.