This article introduces a trend following trading strategy based on triple exponential moving averages. The strategy identifies market trends through the crossover relationships between short-term, medium-term, and long-term exponential moving averages, combined with dynamic stop-loss and take-profit mechanisms for trade management.
The strategy makes trading decisions based on three exponential moving averages (EMAs) with different periods: 9, 21, and 55. By observing the crossover relationships and relative positions between these moving averages, it determines market trend direction and strength to find suitable trading opportunities. The strategy also integrates ATR-based dynamic stop-loss and risk-reward ratio based take-profit settings for better risk management.
The core logic of the strategy is to identify trends through the crossover and position relationships of three EMAs. Specifically:
The Triple EMA Trend Trading Strategy is a trading system with clear logic and controllable risk. Through proper parameter settings and optimization, it can obtain stable trading opportunities in different market environments. The key to strategy success lies in correctly understanding and applying the core principles of trend following while maintaining good risk management. In practical application, investors are advised to make appropriate parameter adjustments based on specific market characteristics and their own risk tolerance.
/*backtest start: 2024-10-28 00:00:00 end: 2024-11-27 00:00:00 period: 1h basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("Triple EMA Crossover Strategy", overlay=true) // Define the input lengths for the EMAs shortEmaLength = input(9, title="Short EMA Length") mediumEmaLength = input(21, title="Medium EMA Length") longEmaLength = input(55, title="Long EMA Length") // Define the risk/reward ratios for SL and TP riskRewardRatio = input(1.2, title="Risk/Reward Ratio") // Example: risk 1 to gain 1.2 atrMultiplier = input(1.5, title="ATR Multiplier for SL") // ATR multiplier for stop loss // Calculate EMAs ema9 = ta.ema(close, shortEmaLength) ema21 = ta.ema(close, mediumEmaLength) ema55 = ta.ema(close, longEmaLength) // Plot EMAs on the chart plot(ema9, color=color.blue, title="9 EMA") plot(ema21, color=color.orange, title="21 EMA") plot(ema55, color=color.red, title="55 EMA") // Define Long and Short Conditions longCondition = ta.crossover(ema9, ema21) and ema21 > ema55 shortCondition = ta.crossunder(ema9, ema21) and ema21 < ema55 // Calculate the Average True Range (ATR) for better stop loss positioning atr = ta.atr(14) // Using a 14-period ATR for dynamic SL // Execute Long trades if (longCondition) // Set stop loss and take profit prices stopLoss = close - (atr * atrMultiplier) takeProfit = close + ((close - stopLoss) * riskRewardRatio) strategy.entry("Long", strategy.long, stop=stopLoss, limit=takeProfit) // Execute Short trades if (shortCondition) // Set stop loss and take profit prices stopLoss = close + (atr * atrMultiplier) takeProfit = close - ((stopLoss - close) * riskRewardRatio) strategy.entry("Short", strategy.short, stop=stopLoss, limit=takeProfit)