
이 전략은 T3 이동 평균 지표를 기반으로 트렌드 추적 거래 시스템을 설계했다. 이 시스템은 자동으로 가격 트렌드 방향을 식별하고 그에 따라 더 많은 공백을 할 수 있다. 가격이 상승 할 때 더 많은 공백을 하고, 가격이 떨어질 때 공백을 한다. 이 시스템은 또한 역전 거래의 기능을 가지고 있다.
이 전략은 가격 트렌드 방향을 판단하기 위해 T3 지표를 사용합니다. T3 지표는 가격 변화에 더 빠르게 반응할 수 있는 더 높은 민감성을 가진 적응형 이동 평균입니다.
T3(n) = GD(GD(GD(n)))
그 중, GD는 넓은 의미의 DEMA를 나타냅니다.
GD(n,v) = EMA(n) * (1+v)-EMA(EMA(n)) * v
v는 물량 인자이며, 이동 평균이 가격의 선형적 추세에 반응하는 민감성을 결정한다. v = 0일 때, GD = EMA; v = 1일 때, GD = DEMA. v = 0.7을 설정하는 것을 추천한다.
이 전략은 T3 지표와 가격을 대조하여, T3 위를 가로질러 가격이 상승 추세로 판단하면, 더 많은 것을 하고; T3 아래를 가로질러 가격이 하락 추세로 판단하면, 공백을 한다.
T3 지표의 매개 변수를 조정하거나 다른 지표 필터를 추가하여 실수 거래를 줄일 수 있다. 단편 손실을 제어하기 위해 스톱로스를 설정할 수도 있다.
이 전략은 T3 지표를 통해 가격 트렌드 방향을 자동으로 판단하고, 수동 판단을 필요로 하지 않고, 자동으로 더 많은 공백을 할 수 있다. 또한 역전 거래 논리를 구성하여, 더 복잡한 시장 상황에 대응할 수 있다. 지표 매개 변수, 거래 논리 등은 최적화 할 여지가 있으며, 전략의 성능을 더욱 우수하게 만들 수 있다.
/*backtest
start: 2023-12-18 00:00:00
end: 2024-01-17 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.00 29/11/2017
// This indicator plots the moving average described in the January, 1998 issue
// of S&C, p.57, "Smoothing Techniques for More Accurate Signals", by Tim Tillson.
// This indicator plots T3 moving average presented in Figure 4 in the article.
// T3 indicator is a moving average which is calculated according to formula:
// T3(n) = GD(GD(GD(n))),
// where GD - generalized DEMA (Double EMA) and calculating according to this:
// GD(n,v) = EMA(n) * (1+v)-EMA(EMA(n)) * v,
// where "v" is volume factor, which determines how hot the moving average’s response
// to linear trends will be. The author advises to use v=0.7.
// When v = 0, GD = EMA, and when v = 1, GD = DEMA. In between, GD is a less aggressive
// version of DEMA. By using a value for v less than1, trader cure the multiple DEMA
// overshoot problem but at the cost of accepting some additional phase delay.
// In filter theory terminology, T3 is a six-pole nonlinear Kalman filter. Kalman
// filters are ones that use the error — in this case, (time series - EMA(n)) —
// to correct themselves. In the realm of technical analysis, these are called adaptive
// moving averages; they track the time series more aggres-sively when it is making large
// moves. Tim Tillson is a software project manager at Hewlett-Packard, with degrees in
// mathematics and computer science. He has privately traded options and equities for 15 years.
//
// You can change long to short in the Input Settings
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
strategy(title="T3 Averages", shorttitle="T3", overlay = true)
Length = input(5, minval=1)
b = input(0.7, minval=0.01,step=0.01)
reverse = input(false, title="Trade reverse")
xPrice = close
xe1 = ema(xPrice, Length)
xe2 = ema(xe1, Length)
xe3 = ema(xe2, Length)
xe4 = ema(xe3, Length)
xe5 = ema(xe4, Length)
xe6 = ema(xe5, Length)
c1 = -b*b*b
c2 = 3*b*b+3*b*b*b
c3 = -6*b*b-3*b-3*b*b*b
c4 = 1+3*b+b*b*b+3*b*b
nT3Average = c1 * xe6 + c2 * xe5 + c3 * xe4 + c4 * xe3
pos = iff(nT3Average > close, -1,
iff(nT3Average < close, 1, nz(pos[1], 0)))
possig = iff(reverse and pos == 1, -1,
iff(reverse and pos == -1, 1, pos))
if (possig == 1)
strategy.entry("Long", strategy.long)
if (possig == -1)
strategy.entry("Short", strategy.short)
barcolor(possig == -1 ? red: possig == 1 ? green : blue )
plot(nT3Average, color=blue, title="T3")