ボリンジャー・バンドの統合戦略

作者: リン・ハーンチャオチャン,日付: 2024-02-22 13:43:14
タグ:

img

概要

ボリンジャーバンド統合戦略は,ボリンジャーバンドを使用して低波動性の統合段階を特定する画期的な戦略である.市場は波動期に入ると,ボリンジャーバンドは収束し,市場に参入する機会を示唆する.また,波動性の減少を確認するために平均真範囲指標も組み込む.

戦略の論理

この戦略は,価格が低波動性統合段階に入るときを検出するために主にボリンジャーバンドに依存する.ボリンジャーバンドの中央帯は閉じる価格の移動平均である.上下帯は中間帯の上下で2つの標準偏差によって抵消される.波動性が低下すると,上下帯の間の距離は顕著に狭くなる.我々はまず,現在のATR値がボリンジャーバンド間の標準偏差よりも小さいかどうかを確認し,初步的に収束を確認する.これは価格が収束に入ったことを示す.

波動性の減少をさらに証明するために,ATR値の移動平均値が下向き傾向にあるかどうかを確認します.平均ATRの減少は波動性が低下している側からも確認されます.両方の条件が同時に満たされると,ボリンジャー帯が有意な収束を示したことを決定します.これは優れた購入機会です.

ATR値の2倍のストップ・ロスの距離で 移動ストップ・ロスの戦略を有効にします これは損失を効果的に制御します

利点分析

この戦略の最大の利点は,市場が低波動性 konsolidiation 段階に入るときを正確に決定し,最良の購入機会を特定することが可能である.他の長期戦略と比較して,ボリンジャーバンド konsolidiation 戦略は利益の確率が高くなります.

さらに,この戦略はリスクを積極的に制御するために移動ストップロスを使用する.これは市場情勢が不利である場合でも損失削減を最大化する.多くの長期戦略にはこれが欠けている.

リスク分析

戦略の主なリスクは,ボリンジャーバンド指標が100%の価格変動の変化を正確に決定することができないことです.ボリンジャーバンドが変動が減少したことを誤って判断すると,入場タイミングが不利かもしれません.この時点で,移動ストップロスは重要な役割を果たし,できるだけ早く取引を終了することができます.

また,戦略の様々なパラメータの設定も結果に影響します.戦略をより堅牢にするために,広範なバックテストを通じてパラメータを最適化する必要があります.

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

Bollinger Bands が収束するときにトレンドインジケーターのターニングサインを確認するために他の指標を追加することを検討することができます.例えば,Bollinger Bands が収束するときに,MACD 差が正から負に転移した,または RSI が過買いゾーンから引き戻されたことを要求します.これは購入信号の正確性をさらに向上させることができます.

別の方向は,ボリンジャー帯,ATR,移動ストップ損失の倍数などの異なるパラメータ設定が結果に与える影響をテストすることです.最適なパラメータ組み合わせを見つけるために段階的な最適化を使用する必要があります.

結論

ボリンジャーバンドの統合戦略は,ボリンジャーバンドを使用して価格変動の減少のタイミングを決定し,リスクを効果的に制御するために移動ストップロスを使用します.これは比較的安定した長期間のブレイクアウト戦略です.戦略の強度を高めるために,パラメータをさらに最適化し,他の指標を組み込む必要があります.


/*backtest
start: 2023-02-15 00:00:00
end: 2024-02-21 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © DojiEmoji

//@version=4
strategy("[KL] Bollinger Bands Consolidation Strategy",overlay=true,pyramiding=1)

// Timeframe {
backtest_timeframe_start = input(defval = timestamp("01 Apr 2016 13:30 +0000"), title = "Backtest Start Time", type = input.time)
USE_ENDTIME = input(false,title="Define backtest end-time (If false, will test up to most recent candle)")
backtest_timeframe_end = input(defval = timestamp("19 Apr 2021 19:30 +0000"), title = "Backtest End Time (if checked above)", type = input.time)
within_timeframe = true
// }

// Indicator: BOLL bands {
BOLL_length = 20//input(20,title="Periods to lookback for BOLL and ATR calc. (default 20)")
BOLL_src = close
BOLL_center = sma(BOLL_src, BOLL_length)
BOLL_sDEV_x2 = 2 * stdev(BOLL_src, BOLL_length)
BOLL_upper = BOLL_center + BOLL_sDEV_x2
BOLL_lower = BOLL_center - BOLL_sDEV_x2
plot(BOLL_center, "Basis", color=#872323, offset = 0)
BOLL_p1 = plot(BOLL_upper, "Upper", color=color.navy, offset = 0, transp=50)
BOLL_p2 = plot(BOLL_lower, "Lower", color=color.navy, offset = 0, transp=50)
fill(BOLL_p1, BOLL_p2, title = "Background", color=#198787, transp=85)
// }
// ATR and volatility Indicator {
ATR_x2 = atr(BOLL_length) * 2 // multiplier aligns with BOLL
avg_volat = sma(ATR_x2, BOLL_length)
//}

// Trailing stop loss {
var entry_price = float(0)
var trailing_SL_buffer = float(0)
var stop_loss_price = float(0)
trail_profit_line_color = color.green
UPDATE_ATR_TSL = false
if strategy.position_size == 0 or not within_timeframe // make TSL line less visible
    trail_profit_line_color := color.black
    stop_loss_price := close - trailing_SL_buffer
else if strategy.position_size > 0
    if UPDATE_ATR_TSL and ATR_x2 < trailing_SL_buffer
        trailing_SL_buffer := ATR_x2
    stop_loss_price := max(stop_loss_price, close[1] - trailing_SL_buffer)
plot(stop_loss_price,color=trail_profit_line_color)
// }


IGNORE_BOLL_SHAPE = false//input(false,title="Ignore BOLL (vs ATR) during entry (experimental)")
IGNORE_VOLATILITY = false///input(false,title="Ignore average ATR during entry (experimental)")
// Main:
if within_timeframe
    // ENTRY:
    if (ATR_x2 > BOLL_sDEV_x2 or IGNORE_BOLL_SHAPE) and (avg_volat < avg_volat[1] or IGNORE_VOLATILITY)
        if strategy.position_size == 0
            entry_price := close
            trailing_SL_buffer := ATR_x2
            stop_loss_price := close - ATR_x2
            strategy.entry("Long",strategy.long, comment="enter")
        if strategy.position_size > 0
            strategy.entry("Long",strategy.long, comment="+")

    // EXIT:
    if strategy.position_size > 0
        if low <= stop_loss_price
            if close > entry_price
                strategy.close("Long", comment="take profit")
            else if low <= entry_price
                strategy.close("Long", comment="stop loss")
    
            if strategy.position_size == 0
                entry_price := 0
                

もっと