Strategy
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.
Mean-reversion strategy using the Relative Strength Index. Buys when RSI drops below the oversold threshold (default 30), indicating a potential bounce. Exits when RSI rises above the overbought threshold (default 70).
class RSIReversion(Strategy):
n = 14
oversold = 30
overbought = 70
def init(self):
self.rsi = self.I(_rsi, self.data.Close, self.n)
def next(self):
if self.rsi[-1] < self.oversold and not self.position:
self.buy()
elif self.rsi[-1] > self.overbought and self.position:
self.position.close()| Total return | +25.784% |
| Net profit | $257,841 |
| Gross profit | $584,930 |
| Gross loss | $341,845 |
| CAGR | +6.292% |
| Annualized return | +6.292% |
| Monthly average return | +0.513% |
| Median monthly return | +0.447% |
| Best month return | +8.234% |
| Worst month return | -6.005% |
| Rolling 1-month return | +14.998% |
| Return per trade | +1.434 |
| Log return CAGR | +25.815% |
| Compounded vs simple return difference | -16.367% |
14 trades · green dashes = buy entries · red dashes = sell exits
| Total return | +65.320% |
| Net profit | $653,200 |
| Gross profit | $825,560 |
| Gross loss | $267,170 |
| CAGR | +16.320% |
| Annualized return | +16.320% |
| Monthly average return | +1.231% |
| Median monthly return | +2.018% |
| Best month return | +10.874% |
| Worst month return | -2.479% |
| Rolling 1-month return | +20.848% |
| Return per trade | +3.663 |
| Log return CAGR | +117.179% |
| Compounded vs simple return difference | -29.283% |