リバース トライアッド 量的な戦略

作者: リン・ハーンチャオチャン, 日時: 2023-12-01 14:14:46
タグ:

img

概要

リバーストライアッド定量戦略は,トレンド逆転を判断し,より正確な取引シグナルを生成するために123リバース戦略と加速器振動器を組み合わせます.この戦略は主に株式指数,外為,貴金属,エネルギー製品の短期および中期取引に使用されます.

戦略の論理

この戦略は2つの独立した論理コードで構成されています.

第1部は123リバース戦略である.リバース信号を判断する原理は:閉じる価格が2日連続で前の閉じる価格より低く,9日間のSTOCHK線がD線以下で,9日間のSTOCHK線がD線以上で,閉じる価格が2日連続で前の閉じる価格より高くなるときに購入信号が生成される.

2つ目の部分はアクセレータオシレーター指標です.この指標は,アwesome オシレーターとその5期移動平均の違いを計算することによって,Awesome オシレーターの変化速度を反映し,Awesome オシレーターよりも早くトレンド逆転点を特定するのに役立ちます.

最後に,この戦略は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 ) 

もっと