This strategy mainly uses the Relative Strength Index (RSI) indicator to judge overbought and oversold situations, and uses the 200-day Simple Moving Average (200 Day SMA) as the main price trend filter. On the basis of determining the trend direction, it uses the RSI indicator to find better entry and exit timing to achieve profitability. Compared with using the RSI indicator alone, this strategy increases trend judgment and can more accurately grasp market trends, chase rises and sell declines in a bull market, and do the opposite in a bear market, thereby obtaining higher strategy returns.
The strategy consists mainly of two parts: the RSI indicator and the 200-day SMA filter.
The RSI indicator section mainly judges whether the price has entered the overbought or oversold zone. Its calculation formula is:
RSI = 100 - 100 / (1 + Average gain of up days in RSI / Average loss of down days in RSI)
According to empirical parameters, when RSI < 30, it is oversold; when >70, it is overbought.
The 200-day SMA filter mainly judges the overall market trend direction. When the price is above the 200-day SMA, it is a bull market, otherwise it is a bear market.
Based on the above two judgments, the strategy has the following entry and exit logic:
Long entry: RSI < 45 and Close price > 200-day SMA
Long exit: RSI > 75 and Close price > 200-day SMA
Short entry: RSI > 65 and Close price < 200-day SMA
Short exit: RSI < 25 and Close price < 200-day SMA
Thus, the strategy uses the precise judgment of the RSI indicator to find better entry and exit points in the overall trend and thereby achieve higher returns.
The biggest advantage of this strategy is using the combination of the RSI indicator and 200-day SMA filter to make the strategy more stable and precise:
In addition, the strategy also has the following advantages:
The strategy also has some risks:
To control these risks, the following measures can be taken:
The strategy can be optimized in the following aspects:
The overall performance of this strategy is good, with the advantages of accurate judgment, simple operation, and wide applicability. After adding stop loss and position sizing, it can be carefully run in live trading. Follow-up aspects like parameter optimization, stop loss optimization, position sizing can further enhance the strategy.
/*backtest start: 2023-12-04 00:00:00 end: 2023-12-11 00:00:00 period: 2h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ // This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/ // © LuxAlgo //@version=5 strategy('Relative Strength Index Extremes with 200-Day Moving Average Filte', overlay=true, pyramiding=1, initial_capital=10000, default_qty_type=strategy.cash, default_qty_value=36000, calc_on_order_fills=false, slippage=0, commission_type=strategy.commission.percent, commission_value=0.01) // Rsi rsi_lenght = input.int(14, title='RSI lenght', minval=0) rsi_up = ta.rma(math.max(ta.change(close), 0), rsi_lenght) rsi_down = ta.rma(-math.min(ta.change(close), 0), rsi_lenght) rsi_value = rsi_down == 0 ? 100 : rsi_up == 0 ? 0 : 100 - 100 / (1 + rsi_up / rsi_down) //Sma Length1 = input.int(200, title=' SMA Lenght', minval=1) SMA1 = ta.sma(close, Length1) //Strategy Logic Long = rsi_value < 45 and close > SMA1 Long_exit = rsi_value > 75 and close > SMA1 Short = rsi_value > 65 and close < SMA1 Short_exit = rsi_value < 25 and close < SMA1 if Long strategy.entry('Long', strategy.long) if Short strategy.entry('Short', strategy.short) strategy.close_all(Long_exit or Short_exit) pera(pcnt) => strategy.position_size != 0 ? math.round(pcnt / 100 * strategy.position_avg_price / syminfo.mintick) : float(na) stoploss = input.float(title=' stop loss', defval=5, minval=0.5) los = pera(stoploss) strategy.exit('SL', loss=los) //by wielkieef