Strategy example
RSI strategy Pine Script v6 backtest example.
Backtest a transparent single-position RSI strategy in Pine Script v6 and review its assumptions, trading costs, and risk metrics.
What the strategy tests
This educational mean-reversion example enters after RSI crosses back above an oversold threshold. It closes when RSI crosses above a separate exit level. The script has one long entry ID, no pyramiding, and no request for another timeframe or symbol.
Pine Script v6 code
//@version=6
strategy(
"RSI Mean-Reversion Example",
overlay = false,
pyramiding = 0,
commission_type = strategy.commission.percent,
commission_value = 0.10,
calc_on_every_tick = false,
calc_on_order_fills = false,
process_orders_on_close = false,
use_bar_magnifier = false,
fill_orders_on_standard_ohlc = false
)
length = input.int(14, "RSI Length")
oversold = input.int(30, "Oversold")
exitLevel = input.int(55, "Exit Level")
rsiValue = ta.rsi(close, length)
if ta.crossover(rsiValue, oversold)
strategy.entry("Long", strategy.long)
if ta.crossover(rsiValue, exitLevel)
strategy.close("Long")
plot(rsiValue, color=color.blue)
hline(oversold)
hline(exitLevel)Educational example only. Thresholds are inputs to investigate, not claims about future performance.
Example GPT request
Run this RSI strategy on CRYPTO:ETHUSD using 3-hour bars from 2022-01-01 through 2024-12-31. Use $10,000 initial capital, 0.10% commission, two ticks of slippage, RSI length 14, oversold 30, and exit level 55. Include trade history and yearly returns.
✓ Verified against the public dataset catalog · July 13, 2026
Questions the result should answer
- Does the strategy have enough completed trades to evaluate?
- Are losses concentrated during strong downward trends?
- How much does the result change after realistic costs?
- Do a small number of exceptional trades explain most of the profit?
- Does a separate validation period behave differently?