デュアルシグナル定量的反転戦略


作成日: 2023-12-01 14:14:46 最終変更日: 2023-12-01 14:14:46
コピー: 1 クリック数: 631
1
フォロー
1619
フォロワー

デュアルシグナル定量的反転戦略

概要

双信号定量反転戦略は,123反転戦略と加速器振動器指標を組み合わせて,トレンド反転の判断を実現し,より正確な取引信号を取得する.この戦略は,主に株式指数,外貨,貴金属,エネルギー品種の短線および中線取引に使用される.

戦略原則

この戦略は,2つの独立したコードロジックで構成されています.

第”部は123逆転策略で,逆転信号の判断原理は,閉盘価格が先の閉盘価格より2日連続で低く,第9日STOCH指標K線がD線より低くなるときに多頭信号が生じる.閉盘価格が先の閉盘価格より2日連続で高く,第9日STOCH指標K線がD線より高くなるときに空頭信号が生じる.

第2部は,加速器振動器指標である.この指標は,絶対価格振動器とその5周期移動平均の差値を計算して,絶対価格振動器の変化速度を反映し,トレンドの逆転点を事前に判断することができる.

最後に,この戦略は2つの指標の信号を組み合わせます.両指標の信号が同方向であるとき ((双多数または双空),その方向の取引信号を出力します.両指標の信号が一致しないとき,ゼロ信号を出力します.

優位分析

この戦略は,二重指標判断と組み合わせて,特定の偽信号をフィルターすることができ,信号は正確かつ信頼性があります.同時に,絶対価格振動器は,変化の加速を反映する特性を利用し,潜在的なトレンドの逆転点を事前に捕捉することができ,それによってより大きな利益の余地を得ることができます.

リスク分析

この戦略の最大のリスクは,指標がシグナルを発信する前に価格が明らかに反転し,最適な入場点を逃すことである.さらに,市場が激しく変動するときに,指標パラメータは最適化調整が必要である.

入場点リスクに対して,より多くの反転指標と組み合わせて,信号の信頼性を確保することができる.パラメータ最適化問題に対して,パラメータの合理性を確保するために,動的調整メカニズムを確立することができる.

最適化の方向

この戦略は以下の点で最適化できます.

  1. フィルタリング条件を増やして,高波動期に誤信号を避ける

  2. 複数の検証メカニズムとより多くの反転指標を組み合わせる

  3. パラメータの自適化メカニズムを確立し,指標のパラメータを動的に調整する

  4. 単一ストップを制御するストップ戦略を最適化

要約する

双信号量化逆転戦略は,二重検証によって信号の正確性を高め,市場の重要な逆転点を把握するのに役立ちます.同時に,指標の遅れやパラメータの失敗のリスクを防ぎ,戦略を継続的に検証し,最適化して,変化する市場環境に適応できるようにする必要があります. この戦略は,一定量の取引経験を持つ投資家が使用するのに適しています.

ストラテジーソースコード
/*backtest
start: 2023-11-23 00:00:00
end: 2023-11-30 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=3
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 25/04/2019
// This is combo strategies for get 
// a cumulative signal. Result signal will return 1 if two strategies 
// is long, -1 if all strategies is short and 0 if signals of strategies is not equal.
//
// 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.
//
// Secon strategy
// The Accelerator Oscillator has been developed by Bill Williams 
// as the development of the Awesome Oscillator. It represents the 
// difference between the Awesome Oscillator and the 5-period moving 
// average, and as such it shows the speed of change of the Awesome 
// Oscillator, which can be useful to find trend reversals before the 
// Awesome Oscillator does.
//
// 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

AcceleratorOscillator(nLengthSlow, nLengthFast) =>
    xSMA1_hl2 = sma(hl2, nLengthFast)
    xSMA2_hl2 = sma(hl2, nLengthSlow)
    xSMA1_SMA2 = xSMA1_hl2 - xSMA2_hl2
    xSMA_hl2 = sma(xSMA1_SMA2, nLengthFast)
    nRes =  xSMA1_SMA2 - xSMA_hl2
    cClr = nRes > nRes[1] ? blue : red
    pos = 0.0
    pos := iff(nRes > 0, 1,
             iff(nRes < 0, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal and Accelerator Oscillator (AC)", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
nLengthSlow = input(34, minval=1, title="Length Slow")
nLengthFast = input(5, minval=1, title="Length Fast")
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posAcceleratorOscillator = AcceleratorOscillator(nLengthSlow, nLengthFast)
pos = iff(posReversal123 == 1 and posAcceleratorOscillator == 1 , 1,
	   iff(posReversal123 == -1 and posAcceleratorOscillator == -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 ? red: possig == 1 ? green : blue )