123 リバーサルとスムーズなRSIのコンボ戦略

作者: リン・ハーンチャオチャン開催日:2023年10月16日 16:27:32
タグ:

img

概要

この戦略は123逆転パターンとスムーズなRSI指標を組み合わせ,より高い勝利率のために傾向逆転点をより正確に捉える.これは,任意のタイムフレームとインスツメントに適用できる非常に汎用的な傾向逆転取引戦略です.

戦略の論理

  1. 123 逆転パターン識別:前2日の閉じる価格が高低点を形成し,3日目の閉じる価格が前日より高くなったときの底部逆転信号.前2日の閉じる価格が低高点を形成し,3日目の閉じる価格が前日より低くなったときの上位逆転信号.

  2. スムーズなRSIインジケーター: スムーズなRSIは,重度の移動平均を使用して通常のRSIの遅れを軽減します. 高値を超越するRSIは購入信号です. 低値を超越するRSIは販売信号です.

  3. 戦略シグナル: 123の逆転パターンとスムーズなRSIシグナルが一致するときにのみトレードシグナルが生成されます. 123の逆転が底部を示し,RSIが高いレベルを横切ると購入します. 123の逆転がトップを形成し,RSIが低いレベルを横切ると販売します.

利点

  1. 傾向指標RSIと逆転パターンを組み合わせることで 傾向逆転点を正確に特定できます

  2. 調整されたRSIは通常のRSIの遅延を軽減します

  3. 逆転パターンは単純で簡単に識別できます

  4. 柔軟なパラメータは,異なるツールと時間枠に調整できます.

  5. 拡張性が高く 最適化や改善が容易です

リスク

  1. 簡単な 123 逆転は,小さな引き下がり時に誤った信号を引き起こす可能性があります.

  2. RSIの最適化は不十分で過適性がある.

  3. 双重確認は 取引信号が少なくなります

  4. 取引コストは無視され 小規模な口座が利益を得ることを妨げます

  5. ダウンサイドを制限するストップ・ロスのメカニズムはありません

強化

  1. 最適な組み合わせを見つけるために RSI パラメータを最適化します

  2. 信号フィルタリングのための他の指標やパターンを追加する.

  3. ストップロスを実行して 単一の取引損失を制御する.

  4. 取引コストを考慮し 異なる資本規模に対応するパラメータを調整します

  5. テストパラメータを異なる計器と時間枠で最適パラメータにします.

  6. 自動パラメータ最適化機能を追加します

概要

この戦略は,明確なシンプルな論理を持ち,潜在的なトレンド逆転を特定するためにトレンド指標と組み合わせた逆転パターンを使用する.広範な適用可能性と簡単な最適化の利点があるが,注意し改善すべきリスクもある.全体として,さらなる研究と適用に値する汎用的で実践的な短期逆転取引戦略である.


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

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 20/07/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 is new version of RSI oscillator indicator, developed by John Ehlers. 
// The main advantage of his way of enhancing the RSI indicator is smoothing 
// with minimum of lag penalty. 
//
// 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(Length, TopBand,LowBand) =>
    pos = 0.0
    xValue = (close + 2 * close[1] + 2 * close[2] + close[3] ) / 6
    CU23 = sum(iff(xValue > xValue[1], xValue - xValue[1], 0), Length)
    CD23 = sum(iff(xValue < xValue[1], xValue[1] - xValue, 0), Length)
    nRes = iff(CU23 + CD23 != 0, CU23/(CU23 + CD23), 0)
    pos:= iff(nRes > TopBand, 1,
    	   iff(nRes < LowBand, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Smoothed 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, "---- Smoothed RSI ----")
LengthRSI = input(10, minval=1)
TopBand = input(0.8, step=0.01)
LowBand = input(0.2, step=0.01)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posSRSI = SRSI(LengthRSI, 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 )

もっと