Strategy vault / Trend following
Dual and Triple Exponential Moving Average Crossover Strategy
This strategy is named "Dual and Triple Exponential Moving Average Crossover Strategy". It combines the crossover signals of Dual Exponential Moving Average (DEMA) and Triple Exponential Moving Average (TEMA) to…

I. Strategy Overview
This strategy is named "Dual and Triple Exponential Moving Average Crossover Strategy". It combines the crossover signals of Dual Exponential Moving Average (DEMA) and Triple Exponential Moving Average (TEMA) to determine entries and exits.
II. Strategy Logic
This strategy mainly uses the crossover of Dual Exponential Moving Average (DEMA) and Triple Exponential Moving Average (TEMA) to generate trading signals.
The formula for DEMA is:
DEMA = 2*EMA1 - EMA2
Where EMA1 and EMA2 are Exponential Moving Averages with period N. DEMA combines the smoothness of EMA and responsiveness.
The formula for TEMA is:
TEMA = 3*(EMA1 - EMA2) + EMA3
Where EMA1, EMA2 and EMA3 are Exponential Moving Averages with period N. TEMA filters out fake breakouts by triple smoothing.
When DEMA crosses above TEMA, a buy signal is generated. When DEMA crosses below TEMA, a sell signal is generated. According to the crossover principle, it can capture cycle conversion timely.
III. Advantages
- Both DEMA and TEMA optimize EMA, improving trading accuracy.
- DEMA smooths price change, TEMA filters out fakeouts, forming synergy and improving win rate.
- Combining fast DEMA and slow TEMA, crossover signals are more reliable.
- Capturing cycle conversion timely based on crossover principle.
IV. Risks and Solutions
- Frequent crossover under volatility causes false signals. Parameter tuning needed.
- Inappropriate parameter setting affects signal quality. Parameter optimization required.
- Lack of fundamental validation. Other indicators or models can assist.
V. Optimization
- Test and optimize parameters of DEMA and TEMA to find best combination.
- Add other technical indicators for filtering, e.g. KDJ for trend.
- Add machine learning prediction to validate signals and reduce false signals.
- Check trading volume or sentiment to judge true or fake crossover.
VI. Summary
This strategy generates trading signals from DEMA and TEMA crossover, combining DEMA's responsiveness and TEMA's filtering capability to improve accuracy. But single indicator combo is prone to illusions. Multi-verification tools are still needed to form systematic trading system for long-term steady profits.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_int_1 | 10 | DEMA Length |
| v_input_1_close | 0 | DEMA Source: close | high | low | open | hl2 | hlc3 | hlcc4 | ohlc4 |
| v_input_int_2 | 8 | TEMA Length |
| v_input_2_close | 0 | TEMA Source: close | high | low | open | hl2 | hlc3 | hlcc4 | ohlc4 |
Source Pine Script
/*backtest
start: 2023-12-03 00:00:00
end: 2024-01-02 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("DEMA-TEMA Cross Strategy", shorttitle="DEMA-TEMA Cross", overlay=true)
// Input options for Double EMA (DEMA)
dema_length = input.int(10, title="DEMA Length", minval=1)
dema_src = input(close, title="DEMA Source")
// Calculate Double EMA (DEMA)
dema_e1 = ta.ema(dema_src, dema_length)
dema_e2 = ta.ema(dema_e1, dema_length)
dema = 2 * dema_e1 - dema_e2
// Input options for Triple EMA (TEMA)
tema_length = input.int(8, title="TEMA Length", minval=1)
tema_src = input(close, title="TEMA Source")
// Calculate Triple EMA (TEMA)
tema_ema1 = ta.ema(tema_src, tema_length)
tema_ema2 = ta.ema(tema_ema1, tema_length)
tema_ema3 = ta.ema(tema_ema2, tema_length)
tema = 3 * (tema_ema1 - tema_ema2) + tema_ema3
// Crossover signals for long (small green arrow below candle)
crossover_long = ta.crossover(dema, tema)
// Crossunder signals for short (small red arrow above candle)
crossunder_short = ta.crossunder(dema, tema)
plotshape(crossunder_short ? 1 : na, title="Short Entry", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)
plotshape(crossover_long ? -1 : na, title="Long Entry", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)
plot(dema, "DEMA", color=color.green)
plot(tema, "TEMA", color=color.blue)
if (crossover_long)
strategy.entry("Long", strategy.long)
if (crossunder_short)
strategy.entry("Short", strategy.short)
Published by ChaoZhang on the FMZ strategy square · last modified 2024-01-03. 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-and-Triple-Exponential-Moving-Average-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
- 200 EMA VWAP MFI Trend Following StrategyPine Script · Trend following · 1d
- 4 EMA Trend StrategyPine Script · Trend following · 1d
- ADX MA and EMA Long Only Trend Tracking StrategyPine Script · Trend following · 1d
- ATR Dynamic Trend Following and EMA Crossover Trading StrategyPine Script · Trend following · 1d
- ATR and Moving Average Crossover Hybrid StrategyPine Script · Trend following · 1h
- ATR and T3 Moving Average StrategyPine Script · Trend following · 5m