Multi-Indicator Combination Strategy (CCI, DMI, MACD, ADX)

Author: ChaoZhang, Date: 2024-04-29 14:06:36



This strategy utilizes a combination of multiple technical indicators to generate trading signals. It combines the Commodity Channel Index (CCI), Directional Movement Index (DMI), Moving Average Convergence Divergence (MACD), and Average Directional Index (ADX) to determine buy and sell opportunities. When the combined conditions of CCI, DMI, MACD, and ADX are met, the strategy produces buy or sell signals. The strategy aims to capture market trends while considering momentum and volatility factors.

Strategy Principles

  1. The CCI indicator is used to determine overbought and oversold market conditions. When the CCI value crosses above the oversold level, it indicates a potential market reversal, and the strategy considers a buy signal. When the CCI value crosses below the overbought level, it suggests a potential market pullback, and the strategy considers a sell signal.
  2. The DMI indicator is used to determine the direction and strength of the market trend. When the +DI line is above the -DI line, it indicates an uptrend, while the opposite indicates a downtrend. The strategy uses the trend direction from DMI to determine the direction of trades.
  3. The MACD indicator is used to assess the trend and momentum of the market. When the MACD line is above the signal line, it indicates an uptrend, while the opposite indicates a downtrend. The strategy uses the relative positions of the MACD line and signal line to determine the timing of trades.
  4. The ADX indicator is used to gauge the strength of the market trend. When the ADX value is above a certain threshold (e.g., 20), it suggests a strong market trend, and the strategy is more inclined to follow the trend for trading.
  5. The strategy takes into account the signals from all four indicators and generates buy or sell signals when they collectively meet specific conditions. Buy conditions include the CCI crossing above the oversold level, +DI being above -DI, MACD line being above the signal line, and ADX being above the threshold. Sell conditions are the opposite.

Strategy Advantages

  1. Multi-indicator combination: The strategy utilizes multiple technical indicators, assessing market conditions from different perspectives, enhancing the reliability of trading signals.
  2. Trend tracking: Through indicators like DMI and MACD, the strategy effectively captures market trends and trades in the direction of the trend.
  3. Volatility consideration: The inclusion of the CCI indicator and ADX indicator allows the strategy to consider market volatility factors when determining trade timing, avoiding frequent trades in highly volatile markets.
  4. Risk management: The strategy sets clear entry and exit conditions, helping to control risk and manage positions.

Strategy Risks

  1. Parameter sensitivity: The performance of the strategy may be sensitive to indicator parameters, and different parameter settings may lead to different trading results. Optimization and testing of parameters are necessary to find the optimal combination for specific markets.
  2. Market adaptability: The strategy may underperform in certain market conditions, such as range-bound markets or trend reversal periods. Appropriate adjustments to the strategy are needed to adapt to different market environments.
  3. Slippage and trading costs: Frequent trading may result in higher slippage and trading costs, impacting the overall performance of the strategy. Optimizing trading frequency and controlling trading costs should be considered.

Strategy Optimization Directions

  1. Parameter optimization: Optimize the parameters of the indicators used in the strategy, such as the time periods for CCI and DMI, the fast and slow line periods for MACD, and the threshold for ADX, to find the optimal combination that improves the strategy’s performance.
  2. Inclusion of additional indicators: Consider incorporating other technical indicators, such as the Relative Strength Index (RSI) or Stochastic Oscillator (KDJ), to further refine the conditions for generating trading signals and enhance the reliability of the strategy.
  3. Risk management optimization: Optimize the risk management aspects of the strategy, such as implementing stop-loss and take-profit mechanisms, dynamically adjusting position sizes, etc., to better control risks and protect account safety.
  4. Adaptability optimization: Adjust the buy and sell conditions of the strategy based on different market conditions, such as trending markets or range-bound markets, to improve the strategy’s adaptability to various market environments.


This strategy combines multiple technical indicators, including CCI, DMI, MACD, and ADX, to generate buy and sell signals, aiming to capture market trends and seize trading opportunities. The strengths of the strategy lie in its multi-indicator combination, trend tracking, and volatility consideration. However, it also faces risks such as parameter sensitivity, market adaptability, and trading costs. Future improvements can be made through parameter optimization, inclusion of additional indicators, risk management optimization, and adaptability optimization, to enhance the stability and profitability of the strategy. Overall, this strategy provides a multi-dimensional approach to analyze the market for quantitative trading, but it still requires continuous optimization and refinement in practice.

start: 2023-04-23 00:00:00
end: 2024-04-28 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]

strategy("CCI, DMI, MACD, and ADX Strategy", overlay=true)

// Define inputs
cci_length = input(14, title="CCI Length")
overbought_level = input(100, title="Overbought Level")
oversold_level = input(-100, title="Oversold Level")
adx_threshold = input(20, title="ADX Threshold")
macd_fast_length = input(24, title="MACD Fast Length")
macd_slow_length = input(52, title="MACD Slow Length")
macd_signal_length = input(9, title="MACD Signal Length")

// Calculate CCI
cci_value = ta.cci(close, cci_length)

// Calculate DMI
[di_plus, di_minus, adx_line] = ta.dmi(14, 14)

// Calculate MACD
[macd_line, signal_line, _] = ta.macd(close, macd_fast_length, macd_slow_length, macd_signal_length)

// Define buy and sell conditions
buy_signal = ta.crossover(cci_value, oversold_level) and di_plus > di_minus and macd_line > signal_line and adx_line > adx_threshold
sell_signal = ta.crossunder(cci_value, overbought_level) and di_minus > di_plus and macd_line < signal_line and adx_line > adx_threshold

// Define exit conditions
buy_exit_signal = ta.crossover(cci_value, overbought_level)
sell_exit_signal = ta.crossunder(cci_value, oversold_level)

// Execute trades based on conditions
strategy.entry("Buy", strategy.long, when=buy_signal)
strategy.close("Buy", when=buy_exit_signal)

strategy.entry("Sell", strategy.short, when=sell_signal)
strategy.close("Sell", when=sell_exit_signal)

// Plot CCI
plot(cci_value, title="CCI",

// Plot DMI
plot(di_plus, title="DI+",
plot(di_minus, title="DI-",

// Plot MACD and Signal lines
plot(macd_line, title="MACD",
plot(signal_line, title="Signal", color=color.purple)

// Plot ADX line
plot(adx_line, title="ADX", color=color.yellow)

// Plot overbought and oversold levels
hline(overbought_level, "Overbought",
hline(oversold_level, "Oversold",

// Plot ADX threshold
hline(adx_threshold, "ADX Threshold", color=color.gray)