ボーアバンド変動信号戦略


作成日: 2024-01-15 15:16:27 最終変更日: 2024-01-15 15:16:27
コピー: 0 クリック数: 553
1
フォロー
1617
フォロワー

ボーアバンド変動信号戦略

概要

ボール波帯波動信号戦略 (Bollinger Wave Strategy) は,ボール波帯と移動平均を組み合わせた量的な取引戦略である.この戦略は,ボール波帯の標準差と移動平均の交差信号を計算して,市場の傾向と超買い超売り領域を判断し,取引信号を生成する.

戦略原則

この戦略は,まず,指数移動平均 ((EMA) を指定された周期内での基準線として計算します. そして,このEMAに基づいて上位線 ((EMA + n 倍標準差) と下位線 ((EMA - n 倍標準差) を計算します. 価格が上位線を突破すると,超買い信号,価格が下位線を突破すると,超売り信号になります.

価格が上線と下線の間にあるときは,株式の通常の価格変動区間である.さらに,この戦略は,RSI指標などの他の指標と組み合わせて,取引信号をフィルターし,取引頻度を低下させ,不要な損失を減らす.

具体的には,この戦略の取引シグナルの判断ルールは以下の通りです.

  1. 多頭シグナル:閉盘価格>上軌道線とRSI ((14)>60
  2. 空頭シグナル:閉盘価格<下軌道線で,RSI(14)<40

上記の取引シグナルが発生したときに,固定数量または口座比率方式で入場する. 価格が波帯域に戻ったときに,または反対のシグナルが発生したときに,ポジションを退出する.

戦略的優位性

この戦略は,トレンド判断とオーバーバイオーバーセール判断を組み合わせて,震動整合時に誤った取引を回避する.単一指標戦略と比較して,不必要なポジション開設を減らすことができ,リスクを効果的に制御する.

単純移動平均戦略と比較して,ボールの波帯は,現在の市場の波動性とリスクレベルを反映する.波帯幅が長ければ,取引信号はより信頼できる.波帯幅が大きい場合は,取引頻度は自動的に低下する.この自主的な調整は,異なる市場状況に応じて戦略のリスクを制御する.

また,この戦略はRSIなどの指標によって二重確認され,いくつかの偽信号をフィルターして,トレンドの転換点で誤った取引を避けることができます. これは戦略の勝率も向上します.

リスク分析

この戦略には以下のリスクがあります.

  1. パラメータ最適化のリスク.移動平均のパラメータまたは標準差倍数の設定が不適切であれば,より多くのノイズ取引または逃した取引の機会が生じます.これらのパラメータを繰り返しテストし,最適化する必要があります.

  2. 偽信号の破裂リスク。 短期的な上下線突破の後に価格がすぐに再調節される場合,誤った信号が生じます。 このとき,取引は損失を増加させます。 移動平均周期を拡大したり,ストップを設定したりすることで,このリスクを制御することができます。

  3. 取引頻度リスク。上下軌道線間隔が小さすぎる場合,取引回数と手数料の支払いが増加する。これは最終的な利益に一定の影響を及ぼす。移動平均周期を適切に拡大することで,このリスクを制御できる。

最適化の方向

この戦略をさらに改善する余地があります.

  1. 止損メカニズムを増やす. 移動止損または時間止損を確立し,単一損失を制御するのに役立ちます.

  2. ポジション管理を増やす.例えば,ポジション増減のルールを確立して,利益が上がり,損失が減る.これは戦略の収益率を向上させることができる.

  3. 他の指標のフィルタリング信号と組み合わせて.例えばKDJ,MACDなどの指標は,判断信号の補助的な指標として使用できます.これは,戦略の収益率をさらに向上させるのに役立ちます.

  4. パラメータ設定を最適化する. より優れたパラメータ設定を探すために,遺伝的アルゴリズムなどのより体系的な方法によってパラメータの組み合わせをテストすることができます.

要約する

ボール波帯波動信号戦略は,移動平均のトレンド判断と超買い超売り判断を統合している.波帯範囲の変化に応じて取引頻度を調整し,市場の異なる状態に対応することができる.RSIなどの指標と組み合わせて信号フィルタリングを行い,誤った取引を避ける.この戦略は,市場トレンドを追跡する必要性を考慮するとともに,リスクを制御する.この戦略は,継続的な最適化によって,安定した収益性の定量化取引戦略になることができる.

ストラテジーソースコード
/*backtest
start: 2023-01-08 00:00:00
end: 2024-01-14 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
//@FiboBuLL

strategy(shorttitle='FB Wave', title='FiboBuLL Wave', overlay=true, pyramiding=1, currency=currency.NONE, initial_capital=100000, default_qty_type=strategy.percent_of_equity, default_qty_value=100)

src = input(close, title='Source')
length = input.int(55, minval=1, title='EMA length')  // 20 for classis Bollinger Bands SMA line (basis)


mult = input.float(1., minval=0.236, maxval=2, title='Standard Deviation')  //2 for Classic Bollinger Bands //Maxval = 2 as higher the deviation, higher the risk
basis = ta.sma(src, length)
dev = mult * ta.stdev(src, length)

Show = input.string('Both', options=['Longs Only', 'Shorts Only', 'Both'], title='Trade Type')
CC = input(true, 'Color Bars')

upper = basis + dev
lower = basis - dev

//Conditions for Long and Short - Extra filter condition can be used such as RSI or CCI etc.

short = src < lower  // and rsi(close,14)<40
long = src > upper  // and rsi(close,14)>60

L1 = ta.barssince(long)
S1 = ta.barssince(short)

longSignal = L1 < S1 and not (L1 < S1)[1]
shortSignal = S1 < L1 and not (S1 < L1)[1]

//Plots and Fills


////Long/Short shapes with text
// plotshape(S1<L1 and not (S1<L1)[1]?close:na, text = "sᴇʟʟ", textcolor=#ff0100, color=#ff0100, style=shape.triangledown, size=size.small, location=location.abovebar, transp=0, title = "SELL", editable = true)
// plotshape(L1<S1 and not (L1<S1)[1]?close:na, text = "ʙᴜʏ", textcolor = #008000, color=#008000, style=shape.triangleup, size=size.small, location=location.belowbar, transp=0, title = "BUY", editable = true)  

// plotshape(shortSignal?close:na, color=#ff0100, style=shape.triangledown, size=size.small, location=location.abovebar, transp=0, title = "Short Signal", editable = true)
// plotshape(longSignal?close:na, color=#008000, style=shape.triangleup, size=size.small, location=location.belowbar, transp=0, title = "Long Signal", editable = true)  


p1 = plot(upper, color=color.new(#ff0000, 75), display=display.all, title='Upper Band')
p2 = plot(lower, color=color.new(#008000, 75), display=display.all, title='Lower Band')

p = plot(basis, color=L1 < S1 ? #008000 : S1 < L1 ? #ff0000 : na, linewidth=2, editable=false, title='Basis')

fill(p, p1, color=color.new(color.teal, 85), title='Top Fill')  //fill for basis-upper
fill(p, p2, color=color.rgb(217, 161, 161), title='Bottom Fill', transp=85)  //fill for basis-lower

//Barcolor

bcol = src > upper ? color.new(#8ceb07, 0) : src < lower ? color.new(#ff0000, 0) : src > basis ? color.green : src < basis ? color.red : na

barcolor(CC ? bcol : na, editable=false, title='Color Bars')


// //Alerts ----  // Use 'Once per bar close'

// alertcondition(condition=longSignal, title="Long - BB Filter", message='BB Filter Long @ {{close}}') // Use 'Once per bar close'
// alertcondition(condition=shortSignal, title="Short - BB Filter", message='BB Filter Short @ {{close}}')  // Use 'Once per bar close'

Notestart1 = input(true, '╔═══ Time Range to BackTest ═══╗')

// === INPUT BACKTEST RANGE ===
FromMonth = input.int(defval=1, title='From Month', minval=1, maxval=12)
FromDay = input.int(defval=1, title='From Day', minval=1, maxval=31)
FromYear = input.int(defval=2018, title='From Year', minval=2015)
ToMonth = input.int(defval=1, title='To Month', minval=1, maxval=12)
ToDay = input.int(defval=1, title='To Day', minval=1, maxval=31)
ToYear = input.int(defval=9999, title='To Year', minval=2010)

// === FUNCTION EXAMPLE === 
start = timestamp(FromYear, FromMonth, FromDay, 00, 00)  // backtest start window
finish = timestamp(ToYear, ToMonth, ToDay, 23, 59)  // backtest finish window
window() =>
    time >= start and time <= finish ? true : false

if window() and (Show == 'Longs Only' or Show == 'Both')
    strategy.entry('AL', direction=strategy.long, when=longSignal)
    strategy.close('LongAL', when=shortSignal, comment='AL KAPA')

if window() and (Show == 'Shorts Only' or Show == 'Both')
    strategy.entry('SAT', direction=strategy.short, when=shortSignal)
    strategy.close('SAT', when=longSignal, comment='SAT KAPA')