This is a trend following and trend breakout trading strategy based on RSI and EMA indicators. The strategy name is “RSI-EMA Trend Breakout Strategy”. It incorporates trend tracking and oscillating indicators to capture the medium-to-long term trend direction and enter at trend breakout points.
The strategy uses 5-day EMA, 20-day EMA and 50-day EMA to construct the long and short trend framework. When 5-day EMA crosses over 20-day EMA, and both EMAs are above 50-day EMA, it determines a recent bullish trend breakout for long entry. When 5-day EMA crosses below 20-day EMA, and both EMAs are below 50-day EMA, it determines a recent bearish trend breakout for short entry.
Meanwhile, the strategy also incorporates the RSI indicator to judge if it reaches overbought or oversold zones. RSI can effectively identify overbought and oversold conditions to avoid wrong signals when trend topping or consolidating. When RSI indicator moves from overbought to neutral zone, long position exits. When RSI indicator moves from oversold to neutral zone, short position exits.
This strategy combines EMA and RSI indicators, which can capture medium-to-long term trends and avoid risks at trend ending, with very good risk-reward ratio characteristics. The main advantages are:
There are also some risks in this strategy:
To reduce these risks, we can set stop loss, adjust RSI parameters, or incorporate other indicators for confirmation.
There is room for further optimization of this strategy:
This RSI-EMA trend breakout strategy comprehensively considers trend tracking and entry timing judgment to capture trend profits on the basis of risk control. It is a very practical medium-to-long term strategy. We can further improve the stability and profitability through parameter optimization, adding other indicators etc.
/*backtest start: 2023-11-19 00:00:00 end: 2023-12-19 00:00:00 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © BrendanW98 //@version=4 strategy("My Strategy", overlay=true) ema5 = ema(close, 9) ema20 = ema(close, 21) ema50 = ema(close, 55) //RSI Signals // Get user input rsiSource = close rsiLength = 14 rsiOverbought = 70 rsiOversold = 30 rsiMid = 50 // Get RSI value rsiValue = rsi(rsiSource, rsiLength) //See if RSI crosses 50 doBuy = crossover(rsiValue, rsiOversold) and rsiValue < 50 doSell = crossunder(rsiValue, rsiOverbought) and rsiValue > 50 emacrossover = crossover(ema5, ema20) and ema5 > ema50 and ema20 > ema50 and close > ema50 emacrossunder = crossunder(ema5, ema20) and ema5 < ema50 and ema20 < ema50 and close < ema50 //Entry and Exit longCondition = emacrossover closelongCondition = doSell strategy.entry("Long", strategy.long, 1, when=longCondition) strategy.close("Long", when=closelongCondition) shortCondition = emacrossunder closeshortCondition = doBuy strategy.entry("Short", strategy.short, 1, when=shortCondition) strategy.close("Short", when=closeshortCondition)