STRAT Strategy · Updated March 2026 · ~5 min · For TradingView desktop 3.2.1
Write a Crypto RSI Mean-Reversion Strategy in Pine Script
Trend-following gets beaten up in chop; mean reversion is the opposite — it bets "price snaps back after overextending." This RSI mean-reversion strategy runs as-is.
Open the Pine editor and paste
//@version=6
strategy("RSI Mean Reversion", overlay = true,
initial_capital = 10000,
default_qty_type = strategy.percent_of_equity,
default_qty_value = 15)
r = ta.rsi(close, 14)
if r < 30
strategy.entry("Long", strategy.long)
if r > 50
strategy.close("Long")
// protective stop: exit 6% below entry
stopLevel = strategy.position_avg_price * 0.94
if strategy.position_size > 0
strategy.exit("Stop", "Long", stop = stopLevel)
Logic: enter when RSI < 30 (oversold), take profit back at 50 (the mid), or stop out 6% below. Switch to your coin's daily or 4H, add it to the chart, read the backtest.
Key: use only in ranges
Mean reversion gets crushed in trends — in a one-way drop RSI can flatline low for a long time and you keep averaging into a loss. So add a regime filter: enable it only in clear chop (price in a range, tangled EMAs).
Tip: in the backtest, look at max drawdown before net profit — crypto drawdowns run deep. Fill fees honestly. Tune on one span and validate on another to avoid overfitting.