ダブルインジケーターわずかに逆反転取引戦略


作成日: 2023-10-17 15:45:09 最終変更日: 2023-10-17 15:45:09
コピー: 1 クリック数: 634
1
フォロー
1617
フォロワー

ダブルインジケーターわずかに逆反転取引戦略

概要

双指数略逆転トレード戦略は,動量指標とトレンド指標を組み合わせたショートライントレード戦略である.この戦略は,まず,逆転指標を使用して取引シグナルを生成し,その後,トレンド型の指標と組み合わせて,より信頼できる取引シグナルを生成する.この戦略は,短期間の価格逆転を捉え,中短線トレンドの背景で取引することを目的としている.

原則

この戦略は2つの子戦略で構成されています.

第”のサブ戦略は123反転戦略である.これは,価格が高点の逆転の形を呈しているかどうかを監視するものである.具体的には,次の状況で買入シグナルを生成する.前2日の閉盘価格が下がり,その日の閉盘価格が前2日の閉盘価格より高く,ストキャスティック・スローラインが50以下である.次の状況で売り出シグナルを生成する.前2日の閉盘価格が上り,その日の閉盘価格が前2日の閉盘価格より低く,そしてストキャスティック・スロップラインが50以上である.

2つ目の子戦略は,エルゴディックランダム指数 ((EMDI)) である.これは,中長線トレンドの方向性を識別するトレンド型指数である.それは,移動平均とMACDの思想を組み合わせて,一回目指数平滑移動平均とMACDの快慢線を交差して購入と販売の信号を生成する.

この戦略は2つの子戦略のシグナルを組み合わせている.この戦略は,両子戦略が一致するシグナルを生成するときにのみ,この戦略はポジションを開きます.つまり,それは,短期間のわずかな逆転と強い中長線トレンドサポートがある場合にのみ取引します.

利点

  • 複数の指標を組み合わせて,偽信号を効果的にフィルターし,信号の信頼性を高めることができる.
  • 逆転戦略とトレンド戦略の組み合わせは,短期的な機会を捉え,逆転取引を回避します.
  • ストカスティック指標のパラメータ設定はより堅牢で,whipsawsを減らすことができます.
  • エルゴディック指数平滑パラメータの設定は合理的で,トレンドをよりよく識別することができる。
  • この戦略は,取引の頻度が適度であり,取引の機会を多く獲得し,取引頻度が高くならない.
  • 中中ショートラインの取引に適用され,時間周期の柔軟性がある.

リスク

  • 逆転信号は誤報がある可能性があり,トレンド指標で検証する必要がある.
  • 取引の頻度が低いため,ショートラインの機会を逃す可能性があります.
  • 逆転後,また逆転する可能性があるので,時宜に止めておく必要があります.
  • パラメータの設定を間違えた場合,取引結果に大きな影響を与える可能性があります.
  • モデルが過度に適合するリスクがある.

最適化の方向

  • 異なるパラメータの設定をテストし,サブ戦略のパフォーマンスを最適化できます.
  • 複数の指標を導入し,多要素モデルを構築することができます.
  • 動態パラメータの最適化には,機械学習の方法が組み込まれます.
  • リスクの管理のために,様々な方法を探索できます.
  • 機会コストを研究し,戦略を調整する取引の頻度.
  • 異なる市場環境で戦略の強さをテストできます.

要約する

双指標戦略逆転取引戦略は,逆転とトレンド指標の組み合わせを使用して,中短線で価格の短期逆転の機会を捕捉しようとします.それは誤報信号を効果的にフィルターし,取引リスクを一定程度に制御できます.しかし,この戦略には,短期の機会を逃す可能性,パラメータの感受性,過適合のリスクなどのいくつかの問題があります.より多くの指標を導入し,パラメータの設定を最適化し,取引頻度を調整し,異なる市場でテストすることで,戦略の安定性と収益性をさらに高めることができます.全体的に,双指標戦略逆転取引戦略は,探索と応用に値する簡単な実用的な量化戦略の転換の考え方です.

ストラテジーソースコード
/*backtest
start: 2023-10-09 00:00:00
end: 2023-10-16 00:00:00
period: 15m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 28/07/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 is one of the techniques described by William Blau in his book "Momentum,
// Direction and Divergence" (1995). If you like to learn more, we advise you to
// read this book. 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. 
//
// 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


EMDI(r,s,u,SmthLen) =>
    pos = 0
    xEMA = ema(close, r)
    xEMA_S = close - xEMA
    xEMA_U = ema(ema(xEMA_S, s), u)
    xSignal = ema(xEMA_U, u)
    pos := iff(xEMA_U > xSignal, 1,
    	     iff(xEMA_U < xSignal, -1, nz(pos[1], 0)))
    pos

strategy(title="Combo Backtest 123 Reversal & Ergodic MDI", 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(32, minval=1)
s = input(5, minval=1)
u = input(5, minval=1)
SmthLen = input(3, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posEMDI = EMDI(r,s,u,SmthLen)
pos = iff(posReversal123 == 1 and posEMDI == 1 , 1,
	   iff(posReversal123 == -1 and posEMDI == -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 )