Supertrend

← 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

Supertrend is an ATR-based trailing indicator that flips direction when price crosses the band. Long when price is above the supertrend line, flat when below. Adapts stop distance to current volatility.

Implementation

class Supertrend(Strategy):
    n = 10
    mult = 3

    def init(self):
        st = _supertrend_simple(self.data.High, self.data.Low, self.data.Close, self.n, self.mult)
        self.supertrend = self.I(lambda: st, name="Supertrend")

    def next(self):
        if self.data.Close[-1] > self.supertrend[-1] and not self.position:
            self.buy()
        elif self.data.Close[-1] < self.supertrend[-1] and self.position:
            self.position.close()

Performance metrics

Total return+80.782%
Net profit$807,819
Gross profit$827,365
Gross loss$541,630
CAGR+5.738%
Annualized return+5.738%
Monthly average return+0.486%
Median monthly return-0.090%
Best month return+9.835%
Worst month return-7.905%
Rolling 1-month return+15.019%
Return per trade+0.465
Log return CAGR+6.445%
Compounded vs simple return difference-79.997%

Equity curves

Chart for symbol:

Charts & distributions

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

Equity curve vs ^GSPC — buy/sell signals

Strategy equityIndex (normalized)▲ Buy▼ Sell

20 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+34.454%
Net profit$344,540
Gross profit$580,090
Gross loss$250,360
CAGR+9.311%
Annualized return+9.311%
Monthly average return+0.764%
Median monthly return-1.557%
Best month return+6.013%
Worst month return-6.569%
Rolling 1-month return+10.836%
Return per trade+1.495
Log return CAGR+0.946%
Compounded vs simple return difference-34.080%