
This strategy is a multi-indicator synergistic trend reversal trading system that combines the Relative Strength Index (RSI), Parabolic SAR, and Simple Moving Average (SMA). The core concept is to use RSI overbought/oversold signals to alert potential reversal opportunities, confirm reversal signals through SAR direction changes, and utilize moving averages as dynamic profit-taking and stop-loss references. This multi-indicator synergistic verification method effectively reduces false signals and improves trading reliability.
The strategy operates in three main steps: 1. Signal Alert: Monitor RSI for overbought (>70) or oversold (<30) signals, which often indicate potential price reversals. 2. Entry Confirmation: Within 1-3 candles after an RSI signal, if the SAR indicator also shows a direction reversal (from above to below or vice versa), entry signal is confirmed. Specifically: - Long Entry: SAR moves below price within 3 candles of RSI oversold - Short Entry: SAR moves above price within 3 candles of RSI overbought 3. Exit Mechanism: Use 21-period SMA as dynamic stop-loss line, close positions when price crosses the average: - Long Exit: Price breaks below 21 SMA - Short Exit: Price breaks above 21 SMA
This strategy builds a relatively reliable trend reversal trading system through RSI and SAR coordination. Using moving averages as dynamic risk control tools ensures effective trend capture while achieving dynamic risk control. The main advantages lie in multiple signal verification and clear trading rules, but practical application requires attention to market environment recognition and dynamic parameter optimization. Strategy stability and profitability can be further improved through market environment filtering, stop-loss optimization, position management enhancement, and other improvements.
/*backtest
start: 2024-07-15 00:00:00
end: 2025-02-15 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"BNB_USDT"}]
*/
//@version=5
strategy("SAR + RSI Strategy", overlay=true, margin_long=100, margin_short=100)
// ———————— SAR Parameters ————————
start = input(0.02, "SAR Start")
increment = input(0.02, "SAR Increment")
maximum = input(0.2, "SAR Maximum")
// ———————— RSI Parameters ————————
rsiLength = input(14, "RSI Length")
upperLevel = input(70, "RSI Upper Level")
lowerLevel = input(30, "RSI Lower Level")
// ———————— SMA Parameter ————————
smaLength = input(21, "SMA Exit Length")
// ———————— Indicators Calculation ————————
// SAR Calculation
sarValue = ta.sar(start, increment, maximum)
sarUp = sarValue < close
sarDown = sarValue > close
// RSI Calculation
rsi = ta.rsi(close, rsiLength)
rsiOverbought = ta.cross(rsi, upperLevel)
rsiOversold = ta.cross(rsi, lowerLevel)
// SMA Calculation
sma21 = ta.sma(close, smaLength)
// ———————— Entry Conditions ————————
longCondition =
// RSI oversold signal occurred in last 3 bars
(ta.barssince(rsiOversold) <= 3) and
// SAR reversal to bullish occurs now
sarUp and not sarUp[1]
shortCondition =
// RSI overbought signal occurred in last 3 bars
(ta.barssince(rsiOverbought) <= 3) and
// SAR reversal to bearish occurs now
sarDown and not sarDown[1]
// ———————— Exit Conditions ————————
exitLong = ta.crossunder(close, sma21)
exitShort = ta.crossover(close, sma21)
// ———————— Strategy Execution ————————
strategy.entry("Long", strategy.long, when=longCondition)
strategy.close("Long", when=exitLong)
strategy.entry("Short", strategy.short, when=shortCondition)
strategy.close("Short", when=exitShort)
// ———————— Visualizations ————————
// plot(sarValue, "SAR", style=plot.style_circles, color=sarUp ? color.green : color.red)
// plot(sma21, "21 SMA", color=color.orange)