This strategy mainly uses the Relative Strength Index (RSI) to determine overbought and oversold conditions in the market, combined with the price above the 200-day Simple Moving Average (SMA) as a trend filter, to decide whether to enter a trade. The strategy constructs entry conditions through three RSI indicators. Only when the short-term RSI is below 35 and shows a downward trend for three consecutive periods, while the third-period RSI is below 60, and the current closing price is above the 200-day SMA, will it go long. The exit condition is when the RSI crosses above 50.
This strategy constructs entry conditions through a triple RSI, combined with the price above the long-term moving average as a trend filter, to capture oversold reversal setups. The strategy logic is simple and clear, easy to implement and optimize. However, the strategy also has risks and shortcomings such as signal lag, low trading frequency, and only being able to capture unilateral market moves. It needs continuous debugging and improvement in actual application. By introducing stop loss and profit taking, position management, combining with other indicators and other methods, the stability and profitability of the strategy can be further improved.
/*backtest start: 2023-05-15 00:00:00 end: 2024-05-14 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 //@author Honestcowboy // strategy("Triple RSI [Honestcowboy]" ) // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ >> // ---------> User Inputs <----------- >> // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ >> rsiLengthInput = input.int(5, minval=1, title="RSI Length", group="RSI Settings") rsiSourceInput = input.source(close, "Source", group="RSI Settings") // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ >> // ---------> VARIABLE CALCULATIONS <----------- >> // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ >> up = ta.rma(math.max(ta.change(rsiSourceInput), 0), rsiLengthInput) down = ta.rma(-math.min(ta.change(rsiSourceInput), 0), rsiLengthInput) rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)) // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ >> // ---------> CONDITIONALS <----------- >> // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ >> rule1 = rsi<35 rule2 = rsi<rsi[1] and rsi[1]<rsi[2] and rsi[2]<rsi[3] rule3 = rsi[3]<60 rule4 = close>ta.sma(close, 200) longCondition = rule1 and rule2 and rule3 and rule4 closeCondition = rsi>50 // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ >> // ---------> GRAPHICAL DISPLAY <----------- >> // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ >> hline(30, title="Long Condition Line") hline(50, title="Exit Condition Line") plot(rsi) plotshape(longCondition ? rsi-3 : na, title="Long Condition", style=shape.triangleup, color=color.lime, location=location.absolute) plotshape(closeCondition and rsi[1]<50? rsi+3 : na, title="Exit Condition", style=shape.triangledown, color=#e60000, location=location.absolute) // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ >> // ---------> AUTOMATION AND BACKTESTING <----------- >> // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ >> if longCondition and strategy.position_size==0 strategy.entry("LONG", strategy.long) if closeCondition strategy.close("LONG")