Bollinger Band RSI のデュアルライン戦略

作者: リン・ハーンチャオチャン開催日:2023年12月26日 15時30分26秒
タグ:

img

概要

この戦略は,ボリンジャーバンドと相対強度指数 (RSI) を組み合わせたものです.これは,取引信号を発行する前に,両指標からの信号 - RSIオーバーバイト/オーバーセールおよびボリンジャーバンド上/下線のブレイク - を必要とします.これは,戦略の信号をより厳格かつ信頼性があります.

戦略の論理

  1. 中間線,上線,下線からなるボリンジャー帯を計算する.これは,過去回顧期間の閉値に基づいて計算する.
  2. RSIインジケーターを計算して,市場が過剰に上昇しているか下落しているか判断します.
  3. ショートトレードを開始するには,RSIがオーバーバイト (rsi_overboughtパラメータより高い) と,価格がボリンジャー上線の上を突破した場合に限ります.
  4. RSIが過売 (rsi_oversoldパラメータより低い) と価格がボリンジャー下線を下回るときにのみロングトレードを開始する.

この戦略は,ボリンジャー帯とRSIの両方の合意を必要とするため,単一の指標からの誤解を招くシグナルを操作することを避け,したがってより信頼性があります.

利点

  1. ボリンジャーバンドとRSIの両方の強みを利用し,信号をより厳格にし,間違いを避ける.
  2. ボリンジャー帯は 市場の変動パターンを把握するための ダイナミックなチャンネルを設定します
  3. RSIは過買い/過売りのシナリオを測定し,ピークを追いかけるか,ダウンを阻止します.

リスク

  1. 不適切なボリンガーパラメータは,価格を効果的に包み込むのに失敗する可能性があります.
  2. 誤ったRSIパラメータは,実際の過買い/過売り状態を正確に判断できない可能性があります.
  3. 戦略自体では 傾向の方向性を決定することはできません 他の指標が必要です

上記のリスクに対処するために,パラメータを最適化し,モデルを厳格にテストし,追加の指標で主要な傾向を決定する必要があります.

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

  1. Bollinger Bands を異なるバックバック期でテストして最適なパラメータを見つけます.
  2. 比較的に良い設定を決定するために異なるRSIパラメータをテストします.
  3. 移動平均値などの他の指標を追加して 全体的な傾向を決定します

結論

この戦略は,ボリンジャーバンドとRSIの強みをうまく組み合わせ,両方の指標が一致するときにのみ取引信号を発行する.これは,単一の指標からの誤解を招く信号に作用することを避け,取引をより信頼性있게する.それでも,パラメータは最適化され,モデルが厳格にテストされ,他の指標と主要な傾向が決定され,戦略の安定性と収益性がさらに向上する必要があります.


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

//@version=2
strategy("Bollinger + RSI, Double Strategy (by ChartArt) v1.1", shorttitle="CA_-_RSI_Bol_Strat_1.1", overlay=true)

// ChartArt's RSI + Bollinger Bands, Double Strategy - Update
//
// Version 1.1
// Idea by ChartArt on January 18, 2015.
//
// This strategy uses the RSI indicator 
// together with the Bollinger Bands 
// to sell when the price is above the
// upper Bollinger Band (and to buy when
// this value is below the lower band).
//
// This simple strategy only triggers when
// both the RSI and the Bollinger Bands
// indicators are at the same time in
// a overbought or oversold condition.
//
// In this version 1.1 the strategy was
// both simplified for the user and
// made more successful in backtesting. 
//
// List of my work: 
// https://www.tradingview.com/u/ChartArt/
// 
//  __             __  ___       __  ___ 
// /  ` |__|  /\  |__)  |   /\  |__)  |  
// \__, |  | /~~\ |  \  |  /~~\ |  \  |  
// 
// 


///////////// RSI
RSIlength = input(6,title="RSI Period Length") 
RSIoverSold = 50
RSIoverBought = 50
price = close
vrsi = rsi(price, RSIlength)


///////////// Bollinger Bands
BBlength = input(200, minval=1,title="Bollinger Period Length")
BBmult = 2 // input(2.0, minval=0.001, maxval=50,title="Bollinger Bands Standard Deviation")
BBbasis = sma(price, BBlength)
BBdev = BBmult * stdev(price, BBlength)
BBupper = BBbasis + BBdev
BBlower = BBbasis - BBdev
source = close
buyEntry = crossover(source, BBlower)
sellEntry = crossunder(source, BBupper)
plot(BBbasis, color=aqua,title="Bollinger Bands SMA Basis Line")
p1 = plot(BBupper, color=silver,title="Bollinger Bands Upper Line")
p2 = plot(BBlower, color=silver,title="Bollinger Bands Lower Line")
fill(p1, p2)


///////////// Colors
switch1=input(true, title="Enable Bar Color?")
switch2=input(true, title="Enable Background Color?")
TrendColor = RSIoverBought and (price[1] > BBupper and price < BBupper) and BBbasis < BBbasis[1] ? red : RSIoverSold and (price[1] < BBlower and price > BBlower) and BBbasis > BBbasis[1] ? green : na
barcolor(switch1?TrendColor:na)
bgcolor(switch2?TrendColor:na,transp=50)


///////////// RSI + Bollinger Bands Strategy
if (not na(vrsi))

    if (crossover(vrsi, RSIoverSold) and crossover(source, BBlower))
        strategy.entry("RSI_BB_L", strategy.long, stop=BBlower,  comment="RSI_BB_L")
    else
        strategy.cancel(id="RSI_BB_L")
        
    if (crossunder(vrsi, RSIoverBought) and crossunder(source, BBupper))
        strategy.entry("RSI_BB_S", strategy.short, stop=BBupper,  comment="RSI_BB_S")
    else
        strategy.cancel(id="RSI_BB_S")

//plot(strategy.equity, title="equity", color=red, linewidth=2, style=areabr)

もっと