Strategy vault / Trend following
TEMA Crossover Trading Strategy 427257
This strategy uses the crossover of two triple exponential moving averages (TEMA) with different parameters to generate buy and sell signals. The fast TEMA crossing above the slow TEMA produces buy signals, while…
Overview
This strategy uses the crossover of two triple exponential moving averages (TEMA) with different parameters to generate buy and sell signals. The fast TEMA crossing above the slow TEMA produces buy signals, while crossing below produces sell signals. It combines the smoothness of TEMA to discover potential trend changes.
Strategy Logic
Calculate a fast TEMA with period 34.
Calculate a slow TEMA with period 13.
Fast TEMA crossing above slow TEMA generates buy signals.
Fast TEMA crossing below slow TEMA generates sell signals.
Use strategy module for automated order management.
Advantage Analysis
Smoother TEMA curves reduce false signals.
Crossover captures short and long term trend changes.
Simple and clear trading signals, easy to execute.
Customizable parameters for different timeframes.
Can preset stops and limits for risk control.
Risk Analysis
Improper parameters may generate excessive false signals.
TEMA has some lag, may miss sudden events.
Some major breakouts cannot be warned earlier.
Needs combination with trend and S/R analysis.
Possibility of some retracement risks.
Optimization Directions
Test and optimize parameters for best combinations.
Add filters to ensure high quality signals.
Incorporate analysis of larger trend.
Develop exit mechanisms to prevent overholding.
Adjust fixed stops to dynamic stops.
Test performance in live markets across different instruments and timeframes.
Summary
This strategy utilizes the smoothness of TEMA and crossover logic to generate simple trading signals. With parameter optimization, strict filtering, and risk control, it can become a steady trend following strategy. Overall a practical strategy worth in-depth optimization and testing for improved returns.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | 34 | Length |
| v_input_2 | 13 | Length2 |
Source Pine Script
/*backtest
start: 2023-09-11 00:00:00
end: 2023-09-18 00:00:00
period: 30m
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
strategy(title="TEMA With Alert", shorttitle="ALRTEMA", overlay = true )
//Blue
Length = input(34, minval=1)
xPrice = close
xEMA1 = ema(xPrice, Length)
xEMA2 = ema(xEMA1, Length)
xEMA3 = ema(xEMA2, Length)
nRes = 3 * xEMA1 - 3 * xEMA2 + xEMA3
//RED
Length2 = input(13, minval=1)
xPrice2 = close
xEMA12 = ema(xPrice2, Length2)
xEMA22 = ema(xEMA12, Length2)
xEMA32 = ema(xEMA22, Length2)
nRes2 = 3 * xEMA12 - 3 * xEMA22 + xEMA32
buy = 1
sell = 0
x = if nRes > nRes2
buy
else
sell
c = cross(nRes, nRes2)
xy = "Do Some Thing :" + tostring(x)
alertcondition(c, title="Crosing Found", message=xy)
plot(nRes, color=red)
plot(nRes2, color=blue)
short = cross(nRes, nRes2) and nRes > nRes2
long = cross(nRes, nRes2) and nRes < nRes2
strategy.entry("long", strategy.long, when=long)
strategy.entry("short", strategy.short, when=short)
Published by ChaoZhang on the FMZ strategy square · last modified 2023-09-19. 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/TEMA-Crossover-Trading-Strategy-427257.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