双重リバースバランス戦略

作者: リン・ハーンチャオチャン開催日:2023年12月15日 16:56:20
タグ:

img

概要

双逆バランス戦略は,逆転戦略と経験的モード分解 (EMD) フィルタリングの両方を利用する組み合わせ戦略である. 123逆転システムを使用して最初に取引シグナルを生成し,その後EMDフィルタリングでシグナルを処理し,最終的に入口と出口を確認するために両方のシグナルを組み合わせます.このハイブリッドアプローチは勝利率を改善することができます.

戦略原則

123 逆転システム

123逆転システムは,ウルフ・ジェンセンによる"How I Tripled My Money in the Futures Market"という本から由来する.逆転型戦略に属する.閉じる価格は2日連続で前の閉じるよりも高く,9日間のスローストカスタックは50未満で,逆のセットアップが起こるとショートになる.

経験的モード分解 (EMD)

EMDは適応性のあるデータ分析方法である. データを異なる周波数構成要素に分解し,長期的なトレンドを抽出することができる. ここでは,価格周波数構成要素に基づいて取引信号を生成するために長さを20に,デルタを0.5に,分子を0.1に設定する.

シグナル組み合わせ

ダブルリバースバランス戦略は123リバースシステムとEMDの両方の取引信号を組み合わせます.両システムの信号が一致するときにのみエントリを確認します.このハイブリッドアプローチは勝利率を改善します.

利点分析

デュアルリバーションバランス戦略は,リバース戦略とデジタル信号処理技術の両方の利点を利用する.リバースシステムは短期的なリバース機会を捉え,EMDフィルターは長期的傾向を捉える.両システムを一緒に使用することで安定性が向上する.

また 123 パターンも導入し,望ましくないウィップソウを避ける. そして正しく設定された EMD パラメータは,ノイズをフィルターに役立ちます. これらすべての要因は,より高い勝利率に貢献します.

リスク分析

この戦略の最大のリスクは逆転失敗から生じる.123パターンはそのような確率を減らすが,逆転取引の不確実性は高いままである.また,EMD方法は極端な不安定な市場中に崩壊する可能性がある.

このようなリスクを制御するために,逆転システムのパラメータはより信頼性の高い信号を生成するために調整することができる.より良いフィルタリング性能を達成するために,EMDの代わりに異なるフィルタリング方法も試験することができる.また,損失を制限するために小さなポジションサイズを維持することが必要である.

オプティマイゼーションの方向性

戦略は以下の側面で最適化できます.

  1. 逆転システムのための異なるパラメータセットをテストして最適を見つける

  2. 異なるデジタルフィルタリング方法を試してください. 例えば,ウェーブレット変換,ヒルベルト変換など.

  3. 単一の取引損失を制御するためにストップロスを追加する

  4. より高い方向精度を確保するために他の指標を組み込む

  5. ポジションサイズなどのマネーマネジメントモデルを最適化

概要

ダブルリバーションバランス戦略は,リバーション戦略とデジタル信号処理技術の強みを組み合わせている.適切なパラメータ調整とリスク管理により,安定した取引パフォーマンスを生み出す.この戦略は高度に拡張可能で推奨される.


/*backtest
start: 2023-11-14 00:00:00
end: 2023-12-14 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 30/06/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
// The related article is copyrighted material from Stocks & Commodities Mar 2010
//
// 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

Empirical(Length,Delta,Fraction) =>
    pos = 0
    xBandpassFilter = 0.0
    xPeak = 0.0
    xValley =0.0
    xPrice = hl2
    beta = cos(3.1415 * (360 / Length) / 180)
    gamma = 1 / cos(3.1415 * (720 * Delta / Length) / 180)
    alpha = gamma - sqrt(gamma * gamma - 1)
    xBandpassFilter := 0.5 * (1 - alpha) * (xPrice - xPrice[2]) + beta * (1 + alpha) * nz(xBandpassFilter[1]) - alpha * nz(xBandpassFilter[2])
    xMean = sma(xBandpassFilter, 2 * Length)
    xPeak :=  iff (xBandpassFilter[1] > xBandpassFilter and xBandpassFilter[1] > xBandpassFilter[2], xBandpassFilter[1], nz(xPeak[1])) 
    xValley :=  iff (xBandpassFilter[1] < xBandpassFilter and xBandpassFilter[1] < xBandpassFilter[2], xBandpassFilter[1], nz(xValley[1])) 
    xAvrPeak = sma(xPeak, 50)
    xAvrValley = sma(xValley, 50)
    nAvrPeak = Fraction * xAvrPeak
    nAvrValley = Fraction * xAvrValley
    pos := iff(xMean > nAvrPeak and xMean > nAvrValley, 1,
    	   iff(xMean < nAvrPeak and xMean < nAvrValley, -1, nz(pos[1], 0)))
    pos

strategy(title="Combo Backtest 123 Reversal & Empirical Mode Decomposition", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
LengthEMD = input(20, minval=1)
Delta = input(0.5)
Fraction = input(0.1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posEmpirical = Empirical(LengthEMD,Delta,Fraction)
pos = iff(posReversal123 == 1 and posEmpirical == 1 , 1,
	   iff(posReversal123 == -1 and posEmpirical == -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 )

もっと