Stochastic RSI

← 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

Applies the Stochastic formula to RSI values rather than price, creating a faster and more sensitive oscillator. Enters long when Stochastic RSI is below 20 (oversold RSI), exits above 80.

Implementation

class StochasticRSI(Strategy):
    rsi_n = 14
    stoch_n = 14
    oversold = 20
    overbought = 80

    def init(self):
        rsi = _rsi(self.data.Close, self.rsi_n)
        stoch = _stoch_rsi(rsi, self.stoch_n)
        self.stoch_rsi = self.I(lambda: stoch, name="StochRSI")

    def next(self):
        if self.stoch_rsi[-1] < self.oversold and not self.position:
            self.buy()
        elif self.stoch_rsi[-1] > self.overbought and self.position:
            self.position.close()

Performance metrics

Total return+39.00%
Net profit$390,028
Gross profit$977,467
Gross loss$616,287
CAGR+8.98%
Annualized return+8.98%
Monthly average return+0.73%
Median monthly return+1.09%
Best month return+4.69%
Worst month return-3.79%
Rolling 1-month return+9.08%
Return per trade+0.74
Log return CAGR+8.37%
Compounded vs simple return difference-37.09%

Equity curves

Chart for symbol:

Charts & distributions

2025-06 → 2026-04 · 5-year daily data

Equity curve vs ^GSPC — buy/sell signals

Strategy equityIndex (normalized)▲ Buy▼ Sell

39 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+65.65%
Net profit$656,490
Gross profit$1,016,091
Gross loss$459,309
CAGR+16.52%
Annualized return+16.52%
Monthly average return+1.22%
Median monthly return+5.49%
Best month return+9.54%
Worst month return-2.65%
Rolling 1-month return+12.45%
Return per trade+1.31
Log return CAGR+49.46%
Compounded vs simple return difference-48.55%

Risk & trade diagnostics

Drawdown and rolling Sharpe for one symbol at a time appear in the equity charts above. This section adds strategy-specific views: how each index run for stochastic-rsi sits in risk–return space, engine stop / take-profit settings when present, and per-trade MAE/MFE when OHLC trade stats exist in the JSON. Older static portfolio PNGs aggregated every strategy; these plots are scoped to this strategy only.

Stop loss / take-profit (this run)

These rules were applied when opening positions: fixed stop and take-profit prices from entry (backtesting.py sl / tp), plus an optional maximum hold in bars. They change realized outcomes versus signal-only exits; curves and metrics on this page already reflect them.

Stop loss
5%
Take profit
10%
Max hold

SL/TP combinations (this strategy)

These are strategy-specific SL/TP combinations from the sensitivity sweep. The best Sharpe combination is highlighted.

Best Sharpe combo: SL 5% / TP 10% (0.82)

SLTPSharpeReturnMax DDWin %
5%10%0.8265.65%9.26%69.23%
0%10%0.8165.50%9.77%61.29%
5%15%0.7963.61%9.26%69.23%
5%0%0.7963.82%9.26%69.23%
0%15%0.7963.50%9.79%61.29%
0%0%0.7963.67%9.79%61.29%
3%10%0.7457.89%10.14%61.36%
3%15%0.7255.77%10.98%61.36%
3%0%0.7256.01%10.98%61.36%
5%5%0.6736.24%8.20%69.23%
7%10%0.6651.30%11.86%64.71%
7%15%0.6449.33%12.68%64.71%
7%0%0.6449.54%12.68%64.71%
0%5%0.6337.31%8.72%61.29%
3%5%0.5729.50%8.66%61.36%
7%5%0.4624.08%10.86%64.71%

Performance with these rules (symbol by symbol)

Each row is one run for stochastic-rsi. Values already include the stop / target / max-hold settings shown in the row.

SymbolStop lossTake profitMax holdTotal returnSharpeMax DD
^AXJO (S&P/ASX 200)5%10%22.97%0.5419.49%
^BSESN (BSE Sensex)5%10%17.74%0.3415.93%
^BVSP (Bovespa)5%10%0.89%0.0120.85%
^DJI (Dow Jones Industrial Average)5%10%36.92%0.6611.00%
^FCHI (CAC 40)5%10%15.22%0.2716.61%
^FTSE (FTSE 100)5%10%28.80%0.7316.04%
^GDAXI (DAX)5%10%20.61%0.3014.02%
^GSPC (S&P 500)5%10%65.65%0.889.26%
^GSPTSE (TSX Composite)5%10%26.28%0.5818.55%
^HSI (Hang Seng)5%10%34.08%0.3525.07%
^IXIC (NASDAQ Composite)5%10%77.50%0.8114.76%
^KS11 (KOSPI)5%10%47.73%0.4734.76%
^MERV (Merval)5%10%103.00%0.6619.83%
^N100 (Euronext 100)5%10%40.23%0.6411.47%
^N225 (Nikkei 225)5%10%72.17%0.6817.88%
^NSEI (Nifty 50)5%10%23.99%0.4415.20%
^RUT (Russell 2000)5%10%36.82%0.5225.55%
^SSMI (Swiss Market)5%10%7.17%0.1816.28%
^STOXX50E (Euro Stoxx 50)5%10%45.73%0.5815.36%
^TWII (Taiwan Weighted)5%10%56.57%0.6025.46%

Cross-symbol risk: Sharpe vs max drawdown (this strategy)

One point per index run. X = worst drawdown magnitude (%), Y = Sharpe ratio. Compare how stable the edge is across regions — unlike the site-wide risk report PNGs, this uses only runs for stochastic-rsi.

Trade path: MAE vs MFE

Symbol:
Avg MAE: -2.42%Avg MFE: 3.45%MFE / MAE: 1.43

Each point is one trade: MAE = worst unrealized loss vs entry during the trade; MFE = best unrealized gain. Sample capped in JSON for payload size. With SL/TP enabled, many trades stop out before reaching prior MFE extremes — compare to metrics in the table above.

Parameter optimization

Parameter optimization

Stochastic RSI on ^GSPC. Objective: Sharpe Ratio. 16 runs. Color =

Results by region

Index Performance Statistics

Performance metrics for each index symbol tested with this strategy.

IndexCountryReturn %SharpeSortinoMax DD %Win Rate %TradesProfit FactorVolatility %
MervalArgentina+103.00%0.661.22+19.83%+52.94%681.48+20.27%
S&P/ASX 200Australia+22.97%0.541.04+19.49%+68.00%251.98+14.46%
BovespaBrazil+0.89%0.010.02+20.85%+55.10%491.06+11.83%
TSX CompositeCanada+26.28%0.580.98+18.55%+66.67%361.58+11.75%
Euro Stoxx 50Europe+45.73%0.581.52+15.36%+59.38%322.39+20.51%
Euronext 100Europe+40.23%0.641.46+11.47%+61.29%312.33+16.48%
CAC 40France+15.22%0.270.55+16.61%+54.84%311.43+16.91%
DAXGermany+20.61%0.300.61+14.02%+51.61%311.46+20.19%
Hang SengHong Kong+34.08%0.350.56+25.07%+57.81%641.33+16.58%
BSE SensexIndia+17.74%0.340.50+15.93%+64.71%511.35+9.63%
Nifty 50India+23.99%0.440.67+15.20%+66.00%501.45+9.76%
Nikkei 225Japan+72.17%0.681.20+17.88%+68.97%581.78+15.58%
KOSPISouth Korea+47.73%0.470.81+34.76%+58.33%601.47+16.24%
Swiss MarketSwitzerland+7.17%0.180.32+16.28%+57.14%281.24+12.79%
Taiwan WeightedTaiwan+56.57%0.600.99+25.46%+64.41%591.59+14.68%
FTSE 100UK+28.80%0.731.33+16.04%+59.38%322.00+11.31%
Dow Jones Industrial AverageUS+36.92%0.661.28+11.00%+61.29%312.10+13.69%
NASDAQ CompositeUS+77.50%0.811.76+14.76%+70.45%441.92+19.52%
Russell 2000US+36.82%0.520.83+25.55%+64.58%481.51+17.16%
S&P 500US+65.65%0.881.95+9.26%+69.23%392.21+15.97%