This strategy is a trend following system based on Supertrend, Relative Strength (RS), and Relative Strength Index (RSI). By integrating these three technical indicators, it enters trades when market trends are clear and implements dynamic stop-loss for risk management. The strategy primarily aims to capture strong upward price trends while using RSI to confirm trend sustainability.
The strategy employs a triple-filtering mechanism for trade signals:
The strategy constructs a relatively comprehensive trend following trading system by integrating Supertrend, RS, and RSI indicators. Its main advantage lies in the multiple signal confirmation mechanism enhancing trade reliability, while clear risk control mechanisms provide trading safeguards. Despite potential risks, suggested optimization directions can further improve strategy stability and profitability. This strategy is particularly suitable for markets with clear trends and can serve as a foundation framework for medium to long-term trading.
/*backtest start: 2019-12-23 08:00:00 end: 2025-01-04 08:00:00 period: 1d basePeriod: 1d exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("Sanjay RS&RSI Strategy V3 for nifty 15min, SL-1.3", overlay=true) // Inputs atrLength = input.int(10, title="ATR Length") factor = input.float(3.0, title="ATR Multiplier") rsPeriod = input.int(55, title="RS Period") rsiPeriod = input.int(14, title="RSI Period") rsiThreshold = input.float(60, title="RSI Threshold") stopLossPercent = input.float(2.0, title="Stop Loss (%)", step=0.1) // Adjustable Stop Loss in Percentage // Supertrend Calculation [supertrendDirection, supertrend] = ta.supertrend(factor, atrLength) // RS Calculation rs = (close - ta.lowest(close, rsPeriod)) / (ta.highest(close, rsPeriod) - ta.lowest(close, rsPeriod)) * 100 // RSI Calculation rsi = ta.rsi(close, rsiPeriod) // Entry Conditions buyCondition = (supertrendDirection > 0) and (rs > 0) and (rsi > rsiThreshold) // Exit Conditions exitCondition1 = (supertrendDirection < 0) exitCondition2 = (rs <= 0) exitCondition3 = (rsi < rsiThreshold) exitCondition = (exitCondition1 and exitCondition2) or (exitCondition1 and exitCondition3) or (exitCondition2 and exitCondition3) // Plot Supertrend plot(supertrend, title="Supertrend", color=supertrendDirection > 0 ? color.green : color.red, linewidth=2) // Strategy Entry if (buyCondition) strategy.entry("Buy", strategy.long) // Add Stop Loss with strategy.exit stopLossLevel = strategy.position_avg_price * (1 - stopLossPercent / 100) strategy.exit("SL Exit", from_entry="Buy", stop=stopLossLevel) // Strategy Exit (Additional Conditions) if (exitCondition) strategy.close("Buy")