방향 트렌드 인덱스 거래 전략

저자:차오장, 날짜: 2023-09-18 17:07:55
태그:

전반적인 설명

이 전략은 트렌드를 따르는 트렌드에 대한 가격 트렌드 방향을 결정하기 위해 방향 트렌드 인덱스 (DTI) 를 사용합니다. DTI는 트렌드를 판단하기 위해 기간 동안 가장 높고 가장 낮은 가격의 변화를 비교하며, 상부와 하부 임계값이 신호를 생성합니다. DTI가 상부 대역을 넘을 때 길고, 하부 대역을 넘을 때 짧습니다.

전략 논리

한 기간 동안의 가장 높고 가장 낮은 가격 변화에서 가격 변화 값을 계산합니다. DTI 곡선을 도출하기 위해 여러 지수 이동 평균을 적용합니다. DTI에 대한 상위 및 하위 임계치를 설정하십시오. 지표가 상위 임계치를 넘을 때 긴 신호가 생성됩니다. 하위 임계치를 넘으면 짧은 신호가 발생합니다. 다음 신호가 발생 할 때까지 위치를 유지하십시오.

장점

  • DTI는 더 적은 신호로 트렌드 방향을 정확하게 결정합니다.
  • 소음 거래를 피하기 위해 임계값을 필터링합니다.
  • 단기 변동에 영향을 받지 않고 지속적으로 추세를 따르고
  • 큰 매개 변수 조정 공간

위험성

  • 트렌드 반전 포인트가 정확하게 결정될 수 없기 때문에 손실 위험이 있습니다.
  • DTI 매개 변수 조정이 제대로 되지 않으면 기회를 놓칠 위험이 있습니다.
  • 장기 보유는 더 큰 유출을 초래할 수 있습니다.
  • 낮은 트레이딩 빈도, 높은 트레이딩 빈도에는 적합하지 않습니다.

위험은 계산 기간을 단축하거나 임계치를 조정하거나 반전 지표를 추가함으로써 완화될 수 있습니다.

개선

  • DTI를 계산하기 위한 다른 매개 변수 조합을 테스트합니다.
  • 긴/단한 임계수준 최적화
  • 위험을 통제하기 위해 스톱 로스 전략을 추가하는 것을 고려하십시오.
  • 다양한 제품에서 견고성을 테스트합니다.

결론

DTI 전략은 명확한 신호로부터 트렌드 방향을 정확하게 결정하여 안정적인 장기 수익을 가능하게합니다. 매개 변수 최적화와 같은 추가 정교화는 고품질의 트렌드 추적 시스템으로 만들 수 있습니다.


/*backtest
start: 2023-08-18 00:00:00
end: 2023-09-17 00:00:00
period: 4h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 29/03/2017
// This technique was described by William Blau in his book "Momentum,
// Direction and Divergence" (1995). His book focuses on three key aspects 
// of trading: momentum, direction and divergence. Blau, who was an electrical 
// engineer before becoming a trader, thoroughly examines the relationship between 
// price and momentum in step-by-step examples. From this grounding, he then looks 
// at the deficiencies in other oscillators and introduces some innovative techniques, 
// including a fresh twist on Stochastics. On directional issues, he analyzes the 
// intricacies of ADX and offers a unique approach to help define trending and 
// non-trending periods.
// Directional Trend Index is an indicator similar to DM+ developed by Welles Wilder. 
// The DM+ (a part of Directional Movement System which includes both DM+ and 
// DM- indicators) indicator helps determine if a security is "trending." William 
// Blau added to it a zeroline, relative to which the indicator is deemed positive or 
// negative. A stable uptrend is a period when the DTI value is positive and rising, a 
// downtrend when it is negative and falling. 
//
// You can change long to short in the Input Settings
// Please, use it only for learning or paper trading. Do not for real trading.
////////////////////////////////////////////////////////////
strategy(title="Directional Trend Index (DTI)", shorttitle="DTI")
r = input(14, minval=1)
s = input(10, minval=1)
u = input(5, minval=1)
OS = input(45, minval=1)
OB = input(-45, maxval=-1)
reverse = input(false, title="Trade reverse")
hline(0, color=green, linestyle=line)
xHMU = iff(high - high[1] > 0, high - high[1], 0)
xLMD = iff(low - low[1] < 0, -(low - low[1]), 0)
xPrice = xHMU - xLMD
xPriceAbs = abs(xPrice)
xuXA = ema(ema(ema(xPrice, r),s),u)
xuXAAbs = ema(ema(ema(xPriceAbs, r),s),u)
Val1 = 100 * xuXA
Val2 = xuXAAbs
DTI = iff(Val2 != 0, Val1 / Val2, 0)
pos = iff(DTI > OS, -1,
	     iff(DTI < OB, 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(DTI, color=maroon, title="DTI")
plot(OB, color=blue, title="OB")
plot(OS, color=red, title="OS")

더 많은