Momentum Trend Following DMIADX Crossover Strategy
This strategy combines the DMI (Directional Movement Index) and ADX (Average Directional Index) indicators to identify strong market trends and capture trading opportunities. The strategy uses DMI's +DI and -DI line…

Overview
This strategy combines the DMI (Directional Movement Index) and ADX (Average Directional Index) indicators to identify strong market trends and capture trading opportunities. The strategy uses DMI's +DI and -DI line crossovers to determine trend direction while utilizing the ADX indicator to measure trend strength, only entering trades when trends are clearly established. This is a complete trend following trading system that includes entry signals and risk management features like stop-loss and take-profit levels.
Strategy Principles
The core logic includes several key elements:
- Uses DMI indicator's +DI and -DI lines to judge trend direction, generating long signals when +DI crosses above -DI and short signals when +DI crosses below -DI
- Uses ADX indicator to assess trend strength, with a default threshold of 25, only allowing trades when ADX exceeds the threshold to avoid false signals in choppy markets
- Employs percentage-based stop-loss and take-profit levels for risk control, with default settings of 1% stop-loss and 2% take-profit from entry price
- Strategy parameters are adjustable, including DMI period, ADX period and smoothing parameters, ADX threshold, and stop-loss/take-profit percentages
Strategy Advantages
- Combines trend direction and strength assessment for more reliable trading signals
- Only trades in strong trends, avoiding frequent trading in choppy markets
- Complete risk control system with clear stop-loss and take-profit levels
- Flexible parameters that can adapt to different market conditions
- Clear and simple strategy logic that's easy to understand and execute
- Suitable for medium to long-term trend following and short-term trading
Strategy Risks
- Potential for significant drawdowns during trend reversals
- DMI and ADX are lagging indicators, signals may be relatively delayed
- Improper parameter settings can affect strategy performance
- Consecutive stops possible in choppy markets
- Need to consider impact of trading costs on strategy returns
Mitigation measures:
- Optimize parameter settings to balance signal lag and accuracy
- Combine with other technical indicators for signal confirmation
- Implement proper position sizing
- Regular backtesting to verify strategy effectiveness
Strategy Optimization Directions
- Signal Optimization:
- Add trend confirmation indicators like moving averages
- Optimize dynamic adjustment mechanism for ADX threshold
- Consider incorporating volume indicators for auxiliary judgment
- Risk Control Optimization:
- Introduce dynamic stop-loss mechanisms
- Optimize position management methods
- Add maximum drawdown controls
- Parameter Optimization:
- Develop adaptive parameter adjustment mechanisms
- Set parameter combinations for different market environments
- Optimize stop-loss and take-profit ratio settings
Summary
The DMI+ADX crossover strategy is a classic trend following strategy that combines directional and strength indicators to find trading opportunities in strong trend markets. The strategy features clear logic, comprehensive risk control, and good practicality and scalability. Through continuous optimization and improvement, the strategy can better adapt to different market environments and enhance trading performance.
Source Pine Script
/*backtest
start: 2024-02-19 00:00:00
end: 2024-10-25 08:00:00
period: 4h
basePeriod: 4h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("DMI + ADX Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=250)
// Nastavenie parametrov
adxLength = input.int(14, title="ADX Length")
adxSmoothing = input.int(14, title="ADX Smoothing")
dmiLength = input.int(14, title="DMI Length")
adxThreshold = input.float(25.0, title="ADX Threshold")
stopLossPerc = input.float(1.0, title="Stop Loss (%)")
takeProfitPerc = input.float(2.0, title="Take Profit (%)")
// Výpočet DMI a ADX pomocou ta.dmi
[plusDI, minusDI, adxValue] = ta.dmi(dmiLength, adxSmoothing)
// Nákupné podmienky
longCondition = ta.crossover(plusDI, minusDI) and adxValue > adxThreshold
if (longCondition)
strategy.entry("Long", strategy.long)
// Predajné podmienky
shortCondition = ta.crossunder(plusDI, minusDI) and adxValue > adxThreshold
if (shortCondition)
strategy.entry("Short", strategy.short)
// Definovanie Stop a Limit pre Long pozíciu
longStop = strategy.position_avg_price * (1 - stopLossPerc / 100)
longLimit = strategy.position_avg_price * (1 + takeProfitPerc / 100)
if (strategy.position_size > 0)
strategy.exit("Long Exit", "Long", stop=longStop, limit=longLimit)
// Definovanie Stop a Limit pre Short pozíciu
shortStop = strategy.position_avg_price * (1 + stopLossPerc / 100)
shortLimit = strategy.position_avg_price * (1 - takeProfitPerc / 100)
if (strategy.position_size < 0)
strategy.exit("Short Exit", "Short", stop=shortStop, limit=shortLimit)
// Vizualizácia indikátorov na grafe
plot(adxValue, title="ADX", color=color.blue)
hline(adxThreshold, "ADX Threshold", color=color.gray)
plot(plusDI, title="+DI", color=color.green)
plot(minusDI, title="-DI", color=color.red)
Published by ChaoZhang on the FMZ strategy square · last modified 2025-02-18. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Momentum-Trend-Following-DMIADX-Crossover-Strategy.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- ADX Momentum Trend StrategyPine Script · Momentum · 10m
- Advanced Multi Indicator Trend Following and Momentum Quantitative Trading StrategyPine Script · Momentum · 1h
- Dual EMA Crossover with RSI Momentum Enhanced Trading StrategyPine Script · Momentum · 1d
- Dual EMA Momentum Trend Trading Strategy with Full Body Candle Signal SystemPine Script · Momentum · 2h
- Ergotic Momentum Direction Convergence Trading StrategyPine Script · Momentum · 1d
- Laguerre RSI with ADX Filtered Trading Signals StrategyPine Script · Momentum · 1d