方向性トレンドインデックス取引戦略

作者: リン・ハーンチャオチャン開催日:2023年9月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")

もっと