RSIと移動平均のブレイクアウト戦略

作者: リン・ハーンチャオチャン開催日: 2024-01-24 14:31:01
タグ:

img

概要

RSIと移動平均ブレイクアウト戦略は,RSI指標と移動平均線の両方を活用した定量戦略で,取引機会を決定する.この戦略の基本的なアイデアは,RSIが過買いまたは過売りレベルに達したとき,移動平均の方向でより良いブレイクアウトポイントを探すことである.

戦略の論理

  1. RSI指標とシンプル・ムービング・アベアラインを,ユーザーによって定義されたパラメータに基づいて計算する.

  2. RSIがoversold線 (デフォルト30) を越えると,価格がLONG出口移動平均線以下であれば,ロング信号が生成されます.

  3. RSIがオーバー買いライン (デフォルト70) 以下の線を横切ると,価格がSHORT出口移動平均値以上であればショートシグナルが生成されます.

  4. ユーザは,トレンド移動平均線に基づいてシグナルをフィルタリングを選択することができます.価格がフィルタリング移動平均線以上または以下である場合にのみシグナルが生成されます.

  5. 出口はLONGとSHORT出口移動平均線によって決定されます.

利点分析

  1. 二重指標の設計は,2つの主要な市場要因を組み込むことで正確性を向上させます.

  2. RSIの平均逆転特性を有効に利用してターニングポイントを特定します

  3. 移動平均値の追加フィルターは 論理的厳格性を高め トップとボトムを追いかけるのを避けます

  4. パーソナライズ可能なパラメータは,異なる製品とタイムフレームで最適化することができます.

  5. シンプルな論理は 理解し 修正しやすくします

リスク分析

  1. RSIでは 鞭打ちが一般的です 密度指標が役立ちます

  2. RSIはより長い時間枠で失敗する傾向があります パラメータは調整されてもよいし,追加の指標が助けることができます.

  3. 移動平均値は遅延効果があり,長さが短縮されることもあり,MACDのような指標が役立つこともあります.

  4. 基本論理により,信号の検証のためにより多くの指標を導入する必要があります.

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

  1. RSI パラメータを最適化するか,誤った信号を減らすために密度指標を導入します.

  2. 傾向やサポートを特定するために,DMIやBOLLのような傾向と変動指標を組み込む.

  3. 移動平均値の判断を代替または補完するためにMACDを導入する.

  4. 入り口信号に より多くの論理条件を追加して 不良な突破を避ける

結論

RSIと移動平均ブレイアウト戦略は,RSIの過買い過売り検出と移動平均のトレンド決定を組み合わせ,理論的に平均逆転の機会を活用する.この戦略は,初心者にとって直感的で使いやすくて,さまざまな製品で最適化され,推奨されるスタートアップ定量戦略となっています.より多くの補助指標を導入して信号をさらに検証し,収益性を向上させることができます.


/*backtest
start: 2024-01-16 00:00:00
end: 2024-01-23 00:00:00
period: 5m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//Global Market Signals: RSI Strategy.
//@version=4
strategy("GMS: RSI Strategy", overlay=true)

LongShort = input(title="Long Only or Short Only or Both?", type=input.string, defval="Both", options=["Both", "Long Only", "Short Only"])
RSILength = input(title="RSI Length", type = input.integer ,defval=14)
RSIUpper = input(title="Upper Threshold", type = input.float ,defval=70)
RSILower = input(title="Lower Threshold", type = input.float ,defval=30)
LongExit = input(title="Long Exit SMA Length", type = input.integer ,defval=5)
ShortExit = input(title="Short Exit SMA Length", type = input.integer ,defval=5)
AboveBelow = input(title="Trend SMA Filter?", type=input.string, defval="Above", options=["Above", "Below", "Don't Include"])
TrendLength = input(title="Trend SMA Length", type = input.integer ,defval=200)


//Long Side

if LongShort =="Long Only" and AboveBelow == "Above"
    strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit) and close>sma(close,TrendLength))
    strategy.close("LONG", when = close>sma(close,LongExit))
    
if LongShort =="Long Only" and AboveBelow == "Below"
    strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit) and close<sma(close,TrendLength))
    strategy.close("LONG", when = close>sma(close,LongExit))
    
if LongShort =="Long Only" and AboveBelow == "Don't Include"
    strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit))
    strategy.close("LONG", when = close>sma(close,LongExit))
    
if LongShort =="Both" and AboveBelow == "Above"
    strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit) and close>sma(close,TrendLength))
    strategy.close("LONG", when = close>sma(close,LongExit))
    
if LongShort =="Both" and AboveBelow == "Below"
    strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit) and close<sma(close,TrendLength))
    strategy.close("LONG", when = close>sma(close,LongExit))
    
if LongShort =="Both" and AboveBelow == "Don't Include"
    strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit))
    strategy.close("LONG", when = close>sma(close,LongExit))
    
    
//SHORT SIDE

if LongShort =="Short Only" and AboveBelow == "Above"
    strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit) and close>sma(close,TrendLength))
    strategy.close("SHORT", when = close<sma(close,ShortExit))
    
if LongShort =="Short Only" and AboveBelow == "Below"
    strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit) and close<sma(close,TrendLength))
    strategy.close("SHORT", when = close<sma(close,ShortExit))
    
if LongShort =="Short Only" and AboveBelow == "Don't Include"
    strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit))
    strategy.close("SHORT", when = close<sma(close,ShortExit))
    
if LongShort =="Both" and AboveBelow == "Above"
    strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit) and close>sma(close,TrendLength))
    strategy.close("SHORT", when = close<sma(close,ShortExit))
    
if LongShort =="Both" and AboveBelow == "Below"
    strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit) and close<sma(close,TrendLength))
    strategy.close("SHORT", when = close<sma(close,ShortExit))
    
if LongShort =="Both" and AboveBelow == "Don't Include"
    strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit))
    strategy.close("SHORT", when = close<sma(close,ShortExit))
    
    
    
    
    
    
   





もっと