资源加载中... loading...

TEMA Crossover Trading Strategy

Author: ChaoZhang, Date: 2023-09-19 15:41:47
Tags:

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

  1. Calculate a fast TEMA with period 34.

  2. Calculate a slow TEMA with period 13.

  3. Fast TEMA crossing above slow TEMA generates buy signals.

  4. Fast TEMA crossing below slow TEMA generates sell signals.

  5. Use strategy module for automated order management.

Advantage Analysis

  1. Smoother TEMA curves reduce false signals.

  2. Crossover captures short and long term trend changes.

  3. Simple and clear trading signals, easy to execute.

  4. Customizable parameters for different timeframes.

  5. Can preset stops and limits for risk control.

Risk Analysis

  1. Improper parameters may generate excessive false signals.

  2. TEMA has some lag, may miss sudden events.

  3. Some major breakouts cannot be warned earlier.

  4. Needs combination with trend and S/R analysis.

  5. Possibility of some retracement risks.

Optimization Directions

  1. Test and optimize parameters for best combinations.

  2. Add filters to ensure high quality signals.

  3. Incorporate analysis of larger trend.

  4. Develop exit mechanisms to prevent overholding.

  5. Adjust fixed stops to dynamic stops.

  6. 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.


/*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)





More