
二重トレンド追跡戦略は,二重指標判断トレンドを同時に組み合わせた量化取引戦略である.この戦略は,まず123反転指標判断価格反転信号を使用し,次に方向トレンド指標 ((DTI)) 判断価格トレンド方向を組み合わせて,双重確認下位信号を実現する.
この戦略は主に2つの部分から構成されています.
123 逆転指標の判断原理は次のとおりです.
閉盘価格が2日連続で上昇し,K線が9日連続で50を下回ったとき,多額の取引を行う.
閉盤価格が2日連続で下落し,9日目には速K線が50以上であるとき,空白する.
価格の逆転のタイミングを捉えるために.
DTI指標の判断原理は,一定期間における価格変動の絶対値平均線を計算し,価格の平均波幅で割る.
DTIが超買い線より高い場合,それは下落傾向にあることを示します.
DTIが超売り線を下回ると,上昇傾向が進行していることを示します.
まず,123の反転指数を使って価格が反転信号が出ているかどうかを判断する.そしてDTIの指数と組み合わせて反転後の価格の全体的なトレンド方向を判断する.
これは,単に反転信号に依存する偽反転の問題を回避し,戦略の安定性と収益性を向上させる.
ダブルメーター認証で,偽回転の危険を避ける
逆転とトレンド判断を組み合わせ,操作の柔軟性と安定性を兼ね備える
パラメータの最適化スペースが広く,異なる品種に柔軟に適応できます.
DTIパラメータの設定は経験が必要で,トレンドの方向を誤って判断するのは不適切です.
RANGE市では,反転は必ずしも新しいトレンドの形成を意味するものではなく,震撼を起こす可能性がある.
効率的な止損と単一損失の管理が必要
解決方法:パラメータ最適化テスト + 合理的な止損 + 他の指標と組み合わせる
DTIパラメータをテストし,最適なパラメータの組み合わせを見つける
偽反転信号を他の指標と組み合わせたフィルタリング
ストップ・ストップ戦略を最適化して,最適なストップ・ポイントを見つけましょう.
二重トレンド追跡戦略は,123反転とDTIの二重指標によって確認され,価格反転の本質を効果的に判断し,新しいトレンドの方向を捉え,戦略の収益率を向上させることができます. しかし,パラメータ設定とストップ・ロスの戦略は,戦略の収益スペースを最大化するために継続的にテスト・最適化する必要があります. 全体的に,この戦略は,トレンドと反転取引の優位性を組み合わせて,推奨される量化戦略です.
/*backtest
start: 2023-12-25 00:00:00
end: 2024-01-01 00:00:00
period: 15m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 19/02/2020
// This is combo strategies for get a cumulative signal.
//
// First strategy
// This System was created from the Book "How I Tripled My Money In The
// Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
// The strategy buys at market, if close price is higher than the previous close
// during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
// The strategy sells at market, if close price is lower than the previous close price
// during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
//
// Second strategy
// 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.
//
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
Reversal123(Length, KSmoothing, DLength, Level) =>
vFast = sma(stoch(close, high, low, Length), KSmoothing)
vSlow = sma(vFast, DLength)
pos = 0.0
pos := iff(close[2] < close[1] and close > close[1] and vFast < vSlow and vFast > Level, 1,
iff(close[2] > close[1] and close < close[1] and vFast > vSlow and vFast < Level, -1, nz(pos[1], 0)))
pos
TDI(r,s,u,OS,OB) =>
pos = 0.0
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)))
pos
strategy(title="Combo Backtest 123 Reversal & Directional Trend Index (DTI)", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
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")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posTDI = TDI(r,s,u,OS,OB)
pos = iff(posReversal123 == 1 and posTDI == 1 , 1,
iff(posReversal123 == -1 and posTDI == -1, -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)
if (possig == 0)
strategy.close_all()
barcolor(possig == -1 ? #b50404: possig == 1 ? #079605 : #0536b3 )