This strategy is based on the Relative Strength Index (RSI) indicator. It observes the overbought and oversold states of the RSI indicator and performs buy and sell operations when the RSI reaches the set overbought and oversold thresholds, respectively. At the same time, the strategy also adopts a pyramiding approach to position sizing, gradually increasing positions when certain conditions are met, in order to obtain higher returns.
The core of this strategy is the RSI indicator. The RSI indicator measures the magnitude of price increases and decreases over a period of time by calculating the average magnitude of price increases and decreases on up days and down days over a period of time to reflect the strength of the price trend. When the RSI indicator reaches the set overbought threshold (e.g., 75), it is usually considered that the price has risen excessively and there is a greater possibility of a pullback, at which point the strategy will perform a sell operation. When the RSI indicator reaches the set oversold threshold (e.g., 35), it is usually considered that the price has fallen excessively and there is a greater possibility of a rebound, at which point the strategy will perform a buy operation. At the same time, the strategy also sets conditions for pyramiding, i.e., when the buy/sell conditions are met and the number of open positions has not reached the set maximum, it will continue to increase positions in order to obtain higher returns.
This strategy is based on the classic RSI indicator and makes trading decisions through overbought and oversold signals, while adopting a pyramiding approach to track trends. It has advantages such as simplicity, ease of understanding, and wide applicability. However, in actual application, attention needs to be paid to risks such as parameter setting, oscillating markets, and trend continuation, and appropriate optimizations and improvements should be made according to market characteristics, such as parameter optimization, combination with other indicators, dynamic stop-loss, pyramiding optimization, etc., in order to obtain more robust strategy performance.
/*backtest start: 2023-04-06 00:00:00 end: 2024-04-11 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("RSI Strategy", overlay=true) // Définition des paramètres rsi_length = input(14, title="RSI Length") buy_level = input(35, title="Buy Level") sell_level = input(75, title="Sell Level") pyramiding = input(5, title="Pyramiding") // Calcul du RSI rsi = ta.rsi(close, rsi_length) // Règles d'entrée buy_signal = ta.crossover(rsi, buy_level) sell_signal = ta.crossunder(rsi, sell_level) // Gestion des positions if (buy_signal) strategy.entry("Buy", strategy.long) if (sell_signal) strategy.entry("Sell", strategy.short) // Pyramiding if (strategy.opentrades < pyramiding) strategy.entry("Buy", strategy.long) else if (strategy.opentrades > pyramiding) strategy.entry("Sell", strategy.short) // Tracé du RSI plot(rsi, title="RSI", color=color.blue) hline(buy_level, "Buy Level", color=color.green) hline(sell_level, "Sell Level", color=color.red)