Trend Momentum Strategy Based on 21 EMA, Volume, and RSI

Author: ChaoZhang, Date: 2024-03-08 14:59:14


Strategy Overview

This strategy is an advanced version of the classic 21-day Exponential Moving Average (21 EMA) trading approach, incorporating volume analysis and the Relative Strength Index (RSI) to provide more reliable buy and sell signals. The strategy aims to leverage trend momentum and identify high-probability entry points in both bullish and bearish markets using additional confirmation layers.

Strategy Principles

The core of this strategy is the 21-day EMA. When the price crosses above the EMA, it generates a potential buy signal, and when it crosses below, it generates a potential sell signal, indicating a trend reversal. To enhance signal reliability, volume is used for filtering. Buy signals require the current volume to be significantly higher than the average level (set by a user-defined percentage above the 21-period EMA of volume), suggesting strong buying interest. Conversely, sell signals require the current volume to be lower, indicating reduced selling pressure.

The RSI (14-period by default) serves as a momentum filter. Buy signals are only considered when the RSI is above 50, indicating bullish momentum, while sell signals are considered when the RSI is below 50, highlighting bearish momentum.

The strategy utilizes the Average True Range (ATR) to dynamically set stop-loss levels based on current market volatility. This method helps manage risk by adjusting stop levels according to market conditions.

Buy signals are generated when the price crosses above the 21 EMA, the volume is above the threshold, and the RSI is above 50. The strategy enters a long position with a dynamic stop-loss set below the entry price, determined by the ATR.

Sell signals occur when the price crosses below the 21 EMA, the volume is below the threshold, and the RSI is below 50. The strategy enters a short position with a stop-loss set above the entry price, also determined by the ATR.

Strategy Advantages

  1. Multiple Indicator Combination: The strategy combines trend, volume, and momentum indicators to provide a more comprehensive market analysis, helping to filter out false signals.

  2. Dynamic Stop-Loss: By adjusting stop-loss levels based on ATR, the strategy can better adapt to different market conditions, aiding in risk control.

  3. Adaptability: The strategy can be applied to various financial instruments and time frames, allowing traders to adjust it according to their trading style and risk tolerance.

  4. Trend Following: By capturing the main trend using the 21 EMA, the strategy enables traders to align with the market direction.

Strategy Risks

  1. Parameter Optimization: The strategy’s performance heavily relies on the optimization of input parameters, including the volume threshold percentage, RSI levels, and ATR multiplier. Improper parameter settings may lead to suboptimal strategy performance.

  2. Choppy Markets: In markets with high volatility and no clear trend, the strategy may generate more false signals, resulting in frequent trades and potential losses.

  3. Unexpected Events: Abnormal market events, such as major news announcements or economic data releases, can cause sharp price and volume fluctuations, affecting the strategy’s performance.

Optimization Directions

  1. Multiple Timeframe Confirmation: Consider applying the strategy on different time frames (e.g., 1-hour, 4-hour, daily) and look for signals that are consistent across multiple timeframes to improve reliability.

  2. Profit-Taking Rules: Incorporate profit-taking rules into the current strategy, such as setting profit targets based on risk-reward ratios or price objectives, to lock in profits and optimize strategy returns.

  3. Additional Filters: Explore adding other technical indicators as filters, such as MACD, Bollinger Bands, etc., to further confirm trends and momentum.

  4. Market Environment Adaptation: Adjust strategy parameters based on different market states (e.g., trending, rangebound, high volatility) to adapt to changing market conditions.


The trend momentum strategy based on the 21 EMA, volume, and RSI is a multi-indicator approach designed to capture trends and utilize volume and momentum confirmation to improve signal quality. Through dynamic stop-loss and parameter optimization, the strategy can adapt to different market conditions and manage risk. However, traders should be aware of the risks of over-optimization and frequent trading and make adjustments based on their risk tolerance and trading objectives.

The strategy provides a systematic framework that considers multiple dimensions, including trend, volume, and momentum, to inform trading decisions. By backtesting and optimizing, traders can further enhance the strategy’s performance and make dynamic adjustments based on changing market states. Additionally, combining the strategy with fundamental analysis and risk management principles can form a more comprehensive trading approach.

Overall, the trend momentum strategy based on the 21 EMA, volume, and RSI is a flexible and customizable trading method suitable for traders pursuing trend trading and seeking to improve signal reliability through multiple indicator confirmations. When applying the strategy in practice, traders should carefully assess their risk tolerance, conduct thorough backtesting and optimization, and ensure that it aligns with their trading goals and market environment.

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"}]

strategy("Enhanced 21 EMA Strategy with Volume and RSI", overlay=true)

// Input parameters
input_volumeThresholdPct = input(10, title="Volume Threshold Percentage")
input_rsiPeriod = input(14, title="RSI Period")
input_rsiOverbought = input(70, title="RSI Overbought Level")
input_rsiOversold = input(30, title="RSI Oversold Level")
input_atrPeriod = input(14, title="ATR Period for Stop Loss")
input_atrMultiplier = input(1.5, title="ATR Multiplier for Stop Loss")

// Calculate indicators
ema21 = ta.ema(close, 21)
rsi = ta.rsi(close, input_rsiPeriod)
ema21_volume = ta.ema(volume, 21)
volumeThreshold = ema21_volume * (1 + input_volumeThresholdPct / 100)
atr = ta.atr(input_atrPeriod)

// Generate buy and sell signals with volume and RSI confirmation
buySignal = ta.crossover(close, ema21) and volume > volumeThreshold and rsi > 50
sellSignal = ta.crossunder(close, ema21) and volume < volumeThreshold and rsi < 50

// Plot the 21 EMA and RSI on the chart
plot(ema21,, title="21 EMA")
hline(input_rsiOverbought, "RSI Overbought",
hline(input_rsiOversold, "RSI Oversold",

// Execute buy and sell orders based on signals with dynamic stop-loss levels
if (buySignal)
    strategy.entry("Buy", strategy.long)
    strategy.exit("Sell", "Buy", stop=close - atr * input_atrMultiplier)
if (sellSignal)
    strategy.entry("Sell", strategy.short)
    strategy.exit("Buy", "Sell", stop=close + atr * input_atrMultiplier)

// Plot buy and sell signals on the chart
plotshape(series=buySignal, title="Buy Signal", location=location.belowbar,, style=shape.triangleup, size=size.small, text="Buy")
plotshape(series=sellSignal, title="Sell Signal", location=location.abovebar,, style=shape.triangledown, size=size.small, text="Sell")