Dual Exponential Moving Average Momentum Crossover Trading Strategy
This strategy is a trend-following trading system based on the Triple Exponential Moving Average (TEMA). It captures market trends by analyzing crossover signals between short-term and long-term TEMA indicators…

Overview
This strategy is a trend-following trading system based on the Triple Exponential Moving Average (TEMA). It captures market trends by analyzing crossover signals between short-term and long-term TEMA indicators, incorporating volatility-based stop-loss for risk management. The strategy operates on a 5-minute timeframe, utilizing 300 and 500-period TEMA indicators as the foundation for signal generation.
Strategy Principles
The core logic of the strategy is based on the following key elements:
- Uses two different period TEMAs (300 and 500) to identify trend direction
- Generates long signals when short-term TEMA crosses above long-term TEMA
- Generates short signals when short-term TEMA crosses below long-term TEMA
- Uses 10-period high and low prices to set stop-loss levels
- Holds positions until a reverse signal appears
Strategy Advantages
- Signal Stability: Longer-period TEMAs effectively filter market noise and reduce false signals
- Robust Risk Control: Incorporates volatility-based stop-loss for effective single-trade risk control
- Strong Trend Capture: TEMA responds faster to trends than traditional moving averages
- Complete Trading Loop: Includes clear entry, stop-loss, and profit-taking conditions
- High Parameter Adaptability: Key parameters can be flexibly adjusted based on market characteristics
Strategy Risks
- Sideways Market Risk: Prone to false signals in range-bound markets leading to consecutive losses
- Slippage Risk: 5-minute timeframe may face significant slippage during volatile periods
- Money Management Risk: Fixed-point stop-loss may result in excessive losses during high volatility
- Signal Lag: TEMA indicators have inherent lag, potentially missing optimal entry points
- Parameter Sensitivity: Optimal parameters vary significantly across different market environments
Strategy Optimization
- Add Market Environment Recognition: Incorporate trend strength indicators for parameter adaptation
- Optimize Stop-Loss: Consider implementing ATR-based dynamic stop-loss
- Improve Position Sizing: Dynamically adjust position size based on trend strength
- Enhanced Alert System: Implement early warning signals at key price levels
- Include Volume Analysis: Confirm signal validity with volume indicators
Summary
This strategy is a comprehensive trend-following system that captures trends through TEMA crossovers while managing risk with dynamic stop-loss. The strategy logic is clear, implementation is straightforward, and it demonstrates good practicality. However, when trading live, attention must be paid to market environment identification and risk control. It is recommended to optimize parameters based on actual market conditions after backtesting verification.
Source Pine Script
/*backtest
start: 2019-12-23 08:00:00
end: 2025-01-04 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("TEMA Strategy for Gold", overlay=true)
// Inputs
tema_short_length = input.int(300, title="Short TEMA Length")
tema_long_length = input.int(500, title="Long TEMA Length")
pip_value = input.float(0.10, title="Pip Value (10 pips = 1 point for Gold)")
// Calculate TEMA
tema_short = ta.ema(2 * ta.ema(close, tema_short_length) - ta.ema(ta.ema(close, tema_short_length), tema_short_length), tema_short_length)
tema_long = ta.ema(2 * ta.ema(close, tema_long_length) - ta.ema(ta.ema(close, tema_long_length), tema_long_length), tema_long_length)
// Plot TEMA
plot(tema_short, color=color.blue, title="300 TEMA")
plot(tema_long, color=color.red, title="500 TEMA")
// Crossover conditions
long_condition = ta.crossover(tema_short, tema_long)
short_condition = ta.crossunder(tema_short, tema_long)
// Calculate recent swing high/low
swing_low = ta.lowest(low, 10)
swing_high = ta.highest(high, 10)
// Convert pips to price
pip_adjustment = pip_value * syminfo.mintick
// Long entry logic
if (long_condition and strategy.position_size == 0)
stop_loss_long = swing_low - pip_adjustment
strategy.entry("Long", strategy.long)
label.new(bar_index, swing_low, style=label.style_label_down, text="Buy", color=color.green)
// Short entry logic
if (short_condition and strategy.position_size == 0)
stop_loss_short = swing_high + pip_adjustment
strategy.entry("Short", strategy.short)
label.new(bar_index, swing_high, style=label.style_label_up, text="Sell", color=color.red)
// Exit logic
if (strategy.position_size > 0 and short_condition)
strategy.close("Long")
label.new(bar_index, high, style=label.style_label_up, text="Exit Long", color=color.red)
if (strategy.position_size < 0 and long_condition)
strategy.close("Short")
label.new(bar_index, low, style=label.style_label_down, text="Exit Short", color=color.green)
Published by ChaoZhang on the FMZ strategy square · last modified 2025-01-06. 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/Dual-Exponential-Moving-Average-Momentum-Crossover-Trading-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
- Advanced Multi Indicator Trend Following and Momentum Quantitative Trading StrategyPine Script · Momentum · 1h
- Cross Period Momentum EMA Strategy with RSI and Dynamic ATR Stop LossPine Script · Momentum · 1d
- 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
- Dynamic Trend Channel and Relative Strength Momentum Trading StrategyPine Script · Momentum · 3h
- KST EMA Momentum Trend Following StrategyPine Script · Momentum · 1d