
The Dual EMA Trend Following Quantitative Strategy is a trading system based on Exponential Moving Averages (EMA) that identifies sustainable market trends by comparing the difference between fast and slow EMAs against the Average True Range (ATR). This strategy is specifically designed for long-term traders seeking stable and persistent trend signals, utilizing a dynamically adjusted ATR multiplier as a filter to effectively reduce false signals and improve trading quality.
The core principle of this strategy is based on the interaction between two Exponential Moving Averages with different periods. The specific implementation is as follows:
The strategy uses ATR as a dynamic threshold that automatically adjusts signal sensitivity based on market volatility, allowing the strategy to maintain stable performance across different volatility environments.
Risk mitigation methods: - Add additional trend confirmation indicators, such as Relative Strength Index (RSI) or MACD - Implement appropriate stop-loss strategies, such as trailing stops or fixed percentage stops - Find more robust parameter settings by backtesting parameter combinations under different market conditions - Pause trading or adjust parameters in sideways markets to reduce false signals
The core objective of these optimization directions is to enhance the robustness of the strategy, maintaining good performance across a wider range of market conditions while strengthening risk management functions to protect capital.
The Dual EMA Trend Following Quantitative Strategy is a well-designed trading system that provides reliable trend signals by combining Exponential Moving Averages with the Average True Range indicator. Its core strength lies in using dynamic thresholds to filter market noise, making trading signals more reliable.
This strategy is particularly suitable for traders seeking long-term, stable trends, reducing trading costs and psychological pressure by minimizing frequent trading and false signals. Although inherent risks exist, such as delayed trend confirmation and poor performance in ranging markets, these can be mitigated through parameter optimization and additional risk management measures.
Further optimization opportunities include multi-timeframe analysis, improved entry and exit mechanisms, dynamic position management, and more comprehensive risk controls. With these improvements, the strategy has the potential to become a comprehensive trading system that adapts to a wider range of market environments and provides stable long-term returns.
/*backtest
start: 2025-03-24 00:00:00
end: 2025-03-25 03:00:00
period: 5m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT"}]
*/
//@version=6
strategy("onetrend Lite v1.0", overlay=true)
// User input
emaFastLen = input.int(30, title="Length EMA Fast")
emaSlowLen = input.int(60, title="Length EMA Slow")
emaMarginATRLen = input.int(60, title="Margin EMA - ATR Length")
emaMarginATRMult = input.float(0.3, title="Margin EMA - ATR Multiplier", step=0.01)
// Moving averages
emaFast = ta.ema(close, emaFastLen)
emaSlow = ta.ema(close, emaSlowLen)
emaDiff = emaFast - emaSlow
// Trend determination
emaBull = emaDiff > emaMarginATRMult * ta.atr(emaMarginATRLen)
emaBear = emaDiff < -emaMarginATRMult * ta.atr(emaMarginATRLen)
/// COLOR DEFINITIONS
clrUp = color.rgb(70, 163, 255)
clrDown = color.rgb(255, 102, 170)
clrNeutral = color.rgb(128, 128, 128)
clrUpFill = color.new(clrUp, 70)
clrDownFill = color.new(clrDown, 70)
clrNeutralFill = color.new(clrNeutral, 70)
// Plotting EMAs with dynamic colors based on trend
emaFastPlot = plot(emaFast, linewidth=2, color=emaBull ? clrUp : emaBear ? clrDown : clrNeutral)
emaSlowPlot = plot(emaSlow, linewidth=2, color=emaBull ? clrUp : emaBear ? clrDown : clrNeutral)
fill(emaFastPlot, emaSlowPlot, color=emaBull ? clrUpFill : emaBear ? clrDownFill : clrNeutralFill)
// Define signals
longSignal = ta.crossover(emaDiff, emaMarginATRMult * ta.atr(emaMarginATRLen))
sellSignal = ta.crossunder(emaDiff, -emaMarginATRMult * ta.atr(emaMarginATRLen))
// Strategy orders: go long at a buy signal, short at a sell signal, and close opposite positions
if longSignal
strategy.entry("Long", strategy.long, comment="Long Entry")
// strategy.close("Short", comment="Close Short")
if sellSignal
// strategy.entry("Short", strategy.short, comment="Short Entry")
strategy.close("Long", comment="Close Long")