DEMA Crossover

← strategies

Strategy

Methodology

This strategy is backtested on daily OHLCV price data across major US equity indices and ETFs. Entry and exit signals are generated from the strategy's indicators with no lookahead bias — trades execute at the open of the bar following the signal.

Performance metrics are computed per symbol and shown individually. The parameter optimization section (where available) runs a grid search over the strategy's key parameters, optimizing for Sharpe ratio. Transaction costs and slippage are not modeled.

The signal logic and indicator code for this strategy is shown in the methodology code section below.

Methodology

Double EMA (2×EMA − EMA of EMA) reduces lag further than a single EMA. The crossover of fast and slow DEMA lines generates signals with less delay than standard EMA crossovers.

Implementation

class DEMACross(Strategy):
    n_fast = 12
    n_slow = 26

    def init(self):
        self.dema_fast = self.I(_dema, self.data.Close, self.n_fast)
        self.dema_slow = self.I(_dema, self.data.Close, self.n_slow)

    def next(self):
        if crossover(self.dema_fast, self.dema_slow):
            self.buy()
        elif crossover(self.dema_slow, self.dema_fast):
            self.position.close()

Performance metrics

Total return+14.564%
Net profit$145,641
Gross profit$611,913
Gross loss$460,835
CAGR+2.431%
Annualized return+2.431%
Monthly average return+0.260%
Median monthly return+1.652%
Best month return+11.191%
Worst month return-7.616%
Rolling 1-month return+19.514%
Return per trade+0.361
Log return CAGR+60.818%
Compounded vs simple return difference-4.963%

Equity curves

Chart for symbol:

Charts & distributions

2024-07 → 2026-04 · 5-year daily data

Equity curve vs ^GSPC — buy/sell signals

Strategy equityIndex (normalized)▲ Buy▼ Sell

26 trades · green dashes = buy entries · red dashes = sell exits

Drawdown (underwater)

Rolling 1-month Sharpe

Rolling 1-month return (%)

Period return (≈ monthly)

Return distribution (bar returns)

MAE vs MFE (trades)

Rolling 12m Beta

Rolling 12m correlation

Monthly returns (run)

Performance Matrix

Total return+31.659%
Net profit$316,590
Gross profit$594,770
Gross loss$284,170
CAGR+8.623%
Annualized return+8.623%
Monthly average return+0.718%
Median monthly return+0.483%
Best month return+13.793%
Worst month return-8.951%
Rolling 1-month return+21.154%
Return per trade+1.067
Log return CAGR+10.604%
Compounded vs simple return difference-27.578%