This strategy combines Stochastic RSI and EMA to detect trends and verify trading signals. When the price retraces above EMA20 to between EMA9 and EMA14, and the Stochastic RSI is below the oversold level, a long signal is generated; when the price retraces below EMA20 to between EMA9 and EMA14, and the Stochastic RSI is above the overbought level, a short signal is generated.
The core idea of this strategy is to use the Stochastic RSI to determine whether the price retracement in the main trend (represented by EMA20) has reached an appropriate overbought or oversold area, while using the fast EMA and medium EMA to verify the strength of the retracement. If the price breaks through the fast EMA and medium EMA, the retracement may end and the trend may reverse, which is not suitable for entering a position. Only when the price retraces between EMA9 and EMA14 is it considered to enter a position in the direction of the trend. This multi-condition verification method can effectively improve signal quality and reduce misjudgments.
This strategy uses Stochastic RSI combined with EMA multi-condition verification to effectively control risk while grasping trend retracements. The overall idea is simple and easy to understand, suitable for beginners to learn and use. However, the strategy itself also has some limitations, such as poor performance in sideways markets, insufficient grasp of trend movements, etc., which need to be flexibly adjusted according to the actual situation. In the future, consideration can also be given to optimizing and improving the strategy from aspects such as dynamic parameters, more indicator verification, and money management to obtain more robust returns. In general, this strategy can serve as a basic template that can be modified and expanded upon, and is a good starting point and learning material.
/*backtest start: 2023-03-02 00:00:00 end: 2024-03-07 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("Crypto-EMA_Pullback=-", overlay=true,initial_capital = 10000000,default_qty_type=strategy.percent_of_equity, default_qty_value=10.0, pyramiding = 10) // Inputs lengthRsi = input(14, title="RSI Length") k = input(3, title="Stoch %K") d = input(3, title="Stoch %D") lengthStoch = input(14, title="Stochastic RSI Length") overSold = input(25, title="Oversold Level") overBought = input(85, title="Overbought Level") emaFastLength = input(9, title="Fast EMA Length") emaMediumLength = input(14, title="Medium EMA Length") emaSlowLength = input(20, title="Slow EMA Length") // Calculating EMAs emaFast = ta.ema(close, emaFastLength) emaMedium = ta.ema(close, emaMediumLength) emaSlow = ta.ema(close, emaSlowLength) // Calculating the RSI and Stoch RSI rsi = ta.rsi(close, lengthRsi) stochRsiK = ta.sma(ta.stoch(rsi, rsi, rsi, lengthStoch), k) stochRsiD = ta.sma(stochRsiK, d) // Entry Conditions bullishCondition = close > emaSlow and close < emaFast and close < emaMedium and stochRsiK < overSold bearishCondition = close < emaSlow and close > emaFast and close > emaMedium and stochRsiK > overBought // Strategy Execution if (bullishCondition) strategy.entry("Long", strategy.long) if (bearishCondition) strategy.entry("Short", strategy.short) // Plotting plot(emaFast, color=color.blue, title="Fast EMA") plot(emaMedium, color=color.orange, title="Medium EMA") plot(emaSlow, color=color.red, title="Slow EMA") hline(overSold, "Oversold", color=color.green) hline(overBought, "Overbought", color=color.red)