ATR Bands

← 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

ATR Bands place upper and lower bands around a rolling SMA using ATR multiples. Enters long when price touches the lower band (mean-reversion), exits when price returns to the midline.

Implementation

class ATRBands(Strategy):
    n = 14; mult = 2

    def init(self):
        upper, mid, lower = _atr_bands(self.data.Close, self.data.High, self.data.Low, self.n, self.mult)
        self.mid = self.I(lambda: mid, name="Mid")
        self.lower = self.I(lambda: lower, name="Lower")

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

Performance metrics

Total return+31.640%
Net profit$316,404
Gross profit$520,914
Gross loss$237,012
CAGR+7.995%
Annualized return+7.995%
Monthly average return+0.621%
Median monthly return+2.806%
Best month return+11.981%
Worst month return-3.870%
Rolling 1-month return+15.835%
Return per trade+1.207
Log return CAGR+44.931%
Compounded vs simple return difference-4.343%

Equity curves

Chart for symbol:

Charts & distributions

2022-12 → 2026-04 · 5-year daily data

Equity curve vs ^GSPC — buy/sell signals

Strategy equityIndex (normalized)▲ Buy▼ Sell

21 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+29.397%
Net profit$293,970
Gross profit$444,350
Gross loss$172,300
CAGR+8.058%
Annualized return+8.058%
Monthly average return+0.612%
Median monthly return+1.957%
Best month return+15.371%
Worst month return-1.684%
Rolling 1-month return+15.371%
Return per trade+1.238
Log return CAGR+42.327%
Compounded vs simple return difference+0.000%