双重確認の逆転取引戦略

作者: リン・ハーンチャオチャン,日付: 2023年11月14日 13:42:47
タグ:

img

概要

双確認逆転取引戦略は,123逆転パターンとストカスティックRSI指標を組み合わせて,堅牢な平均逆転システムを作成します.取引に入る前に2つの確認層を提供し,戦略の正確性と安定性を向上させます.

戦略の論理

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

  1. 123 逆転

123パターンを用いて 潜在的逆転を特定します

  • ローングが終了した場合 < 前回の終了と現在の終了 > 前回の終了と9日間のスローストキャスト < 50

  • 短縮した場合 > 前回の終了および現在の終了 < 前回の終了および9日間の速ストカスティック > 50

これは価格の逆転の早期信号です

  1. ストカスティックRSI

RSIのストカスティック指標を追加確認のために適用します.

  • 長さ14のRSIを計算する

  • RSIのストカスティックを計算し,長さ14で,Kを得ます

  • 3日間のSMAをKでDを得る

  • Kが80を超えると長くなって 20を超えると短くなって

取引は両者が同意するときにのみ始まります

利点分析

この戦略の主要な利点は,正確性を向上させ,ウィップソーを減らす二重確認です.具体的利点には以下が含まれます.

  1. 123 傾向の逆転を早期に検出する

  2. ストカスティックRSIは逆転信号を確認

  3. 組み合わせは勝率を向上させ 誤った信号を減らす

  4. パラメータは,異なる市場のために最適化できます

  5. ライブ取引のためのシンプルでクリーンな実装

リスク分析

この戦略に考慮すべきリスクは:

  1. 失敗した逆転リスク 誤った逆転は損失を引き起こす可能性があります

  2. パラメータの最適化リスク 悪いパラメータが悪いパフォーマンスにつながります

  3. 過剰なリスク 過剰なデータ最適化

  4. 取引頻度が高いリスク 信号が増えるとコストが上がる

  5. コードエラーリスク 実装論理のバグ

可能な解決策:

  1. 損失を制限するために慎重にポジションサイズを設定する.

  2. ウォーク・フォワード最適化方法を採用する.

  3. 高い収益ではなく 安定したパラメータに集中する

  4. 取引頻度を減らすために条件を調整する

  5. 徹底的にコードの論理をテストする

増進 の 機会

この戦略は以下の分野において改善可能である.

  1. 特定の市場のためのパラメータ調整

  2. フィルターを追加して 慌てて逆転を避ける

  3. ストップ・ロスのメカニズムを組み込む

  4. 追加のフィルターで取引頻度を減らす

  5. ダイナミック位置のサイズを導入する

  6. トランザクションコストの調整

結論

双確認逆転戦略は,短期間の平均逆転のための安定的かつ実用的なシステムである. 逆転を捉える敏感性と双確認からの正確性をバランスする. 適切な最適化と修正により,定量戦略ポートフォリオを効果的に補完することができる. しかし,パラメータは堅牢で,過剰なフィットメントやウィップソーなどのリスクは,ライブ取引で慎重に管理されるべきである.


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

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 03/08/2021
// 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 strategy used to calculate the Stochastic RSI
//
// 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


SRSI(lengthRSI,lengthStoch,smoothK,smoothD, TopBand,LowBand) =>
    pos = 0.0
    Source = close
    rsi1 = rsi(Source, lengthRSI)
    k = sma(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
    d = sma(k, smoothD)
    d_cross_80 = cross(d,TopBand) 
    pos := iff(k > TopBand, 1,
              iff(k < LowBand, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Stochastic RSI", shorttitle="Combo", overlay = true)
line1 = input(true, "---- 123 Reversal ----")
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
line2 = input(true, "---- Stochastic RSI ----")
TopBand = input(80, step=0.01)
LowBand = input(20, step=0.01)
lengthRSI = input(14, minval=1)
lengthStoch = input(14, minval=1)
smoothK = input(3, minval=1)
smoothD = input(3, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posSRSI = SRSI(lengthRSI,lengthStoch,smoothK,smoothD, TopBand,LowBand)
pos = iff(posReversal123 == 1 and posSRSI == 1 , 1,
	   iff(posReversal123 == -1 and posSRSI == -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 )

もっと