ボリンジャーバンドとDCAを組み合わせた高頻度取引戦略


作成日: 2024-03-29 16:20:13 最終変更日: 2024-03-29 16:20:13
コピー: 5 クリック数: 828
1
フォロー
1617
フォロワー

ボリンジャーバンドとDCAを組み合わせた高頻度取引戦略

概要

この戦略は”DCA Booster (1 minute) “と呼ばれ,1分間の時間枠で動作する高頻度取引戦略である.この戦略は,ブリン帯とDCA ((ドルコスト平均法) の2つの技術を組み合わせており,市場波動を利用して,利益を得ようと試みるため,複数回買い買いを行う.戦略の主な構想は,価格がブリン帯を下回る2連中のサイクルを,DCAの方法で積み量的にポジションを構築し始める.価格がブリン帯を突破して軌道に乗ると,すべてのポジションを平らにする.同時に,この戦略は,ピラミッド式加仓を許容する.つまり,価格が下がり続けば,戦略は継続的に加仓する.

戦略原則

  1. ブリン帯の計算: シンプル・ムービング・アベアと標準差を用いてブリン帯の上下軌道計算.
  2. DCAパラメータを設定します. 固定金額を複数に分割し,倉庫の建設毎の資金として設定します.
  3. ポジション構築条件:閉盘価格がブルイン帯下軌道より2サイクル連続で低いとき,ポジション構築を開始する.価格が下軌道より継続的に低いかどうかによって,戦略は最大5のポジションを構築することができる.
  4. 平仓条件:価格がブリン帯を横切った時に,すべてのポジションを平仓する.
  5. ピラミッドのポジション: 価格が下がり続けると,戦略はポジションをさらに5位まで引き上げます.
  6. ポジション管理:戦略は,各ポジションのポジション構築を記録し,平置条件を満たしたときに平置する.

戦略的優位性

  1. ブリン帯とDCAの組み合わせにより,市場波動を効果的に捉え,購入コストを削減できます.
  2. ピラミッドは,価格が下がり続ける間も,そのポジションを保持し,利益を得る機会を増やすことができます.
  3. 利潤をすぐに確保できる,シンプルで明快な平仓条件.
  4. 1分などの短い時間枠で使用するのに適し,高周波取引を行うことができます.

戦略リスク

  1. 市場が激しく波動し,価格がブリンを素早く突破して軌道に乗った場合,戦略が平定位置に間に合わず,損失を招く可能性があります.
  2. ピラミッドの加減は,価格が下がり続ける場合,過剰な露出を招き,リスクを増やす可能性があります.
  3. この戦略は,頻繁に取引が起こり,取引コストが高くなるため,不安定な市場ではうまくいかない可能性があります.

戦略最適化の方向性

  1. 単一取引の最大損失を制御するために,平仓条件にストップロスを追加することを考慮することができます.
  2. ピラミッドの加仓の論理を最適化することができる.例えば,価格の下落の幅に応じて加仓量を調整し,過剰な露出を避ける.
  3. RSI,MACDなどの他の指標と組み合わせて,入場と出場の精度を向上させることができます.
  4. ブリン帯の周期や標準差倍数などのパラメータは,異なる市場状況に対応するために最適化できます.

要約する

“DCAブースター (1分) “は,ブリン帯とDCAを組み合わせた高周波取引戦略で,ブリン帯を下回る価格の時に分量にポジションを建設し,価格にブリン帯が走行する時に平仓を打つことで,市場波動を捕捉し,利益を得ようとする.この戦略は,ピラミッドの加仓を許容するが,同時に,市場の大幅な波動と過剰な露出のリスクにも直面する.この戦略のパフォーマンスは,ストップ・ロズ,加仓の最適化論理の導入,他の指標とパラメータの最適化などの方法と組み合わせて,さらに改善することができる.

ストラテジーソースコード
/*backtest
start: 2024-02-27 00:00:00
end: 2024-03-28 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("DCA Booster (1 minute)",
  overlay=true )

// Parameters for Bollinger Bands
length = input.int(50, title="BB Length")
mult = input.float(3.0, title="BB Mult")

// Bollinger Bands calculation
basis = ta.sma(close, length)
dev = mult * ta.stdev(close, length)
upper = basis + dev
lower = basis - dev

// Variables for DCA
cantidad_dolares = 50000
orden1 = cantidad_dolares / close
orden2 = orden1 * 1.2
orden3 = orden2 * 1.3
orden4 = orden3 * 1.5
orden5 = orden4 * 1.5

// Variables for tracking purchases
var comprado1 = false
var comprado2 = false
var comprado3 = false
var comprado4 = false
var comprado5 = false

// Buy conditions
condicion_compra1 = close < lower and close[1] < lower[1] and not comprado1
condicion_compra2 = close < lower and close[1] < lower[1] and comprado1 and not comprado2
condicion_compra3 = close < lower and close[1] < lower[1] and comprado2 and not comprado3
condicion_compra4 = close < lower and close[1] < lower[1] and comprado3 and not comprado4
condicion_compra5 = close < lower and close[1] < lower[1] and comprado4 and not comprado5
// Variables de control
var int consecutive_closes_below_lower = 0
var int consecutive_closes_above_upper = 0

// Entry logic
if condicion_compra1 and barstate.isconfirmed
    consecutive_closes_below_lower := consecutive_closes_below_lower + 1
    if consecutive_closes_below_lower >= 2
        strategy.entry("Compra1", strategy.long, qty=orden1)
        comprado1 := true
        consecutive_closes_below_lower := 0

if condicion_compra2 and barstate.isconfirmed
    consecutive_closes_below_lower := consecutive_closes_below_lower + 1
    if consecutive_closes_below_lower >= 2
        strategy.entry("Compra2", strategy.long, qty=orden2)
        comprado2 := true
        consecutive_closes_below_lower := 0

if condicion_compra3 and barstate.isconfirmed
    consecutive_closes_below_lower := consecutive_closes_below_lower + 1
    if consecutive_closes_below_lower >= 2
        strategy.entry("Compra3", strategy.long, qty=orden3)
        comprado3 := true
        consecutive_closes_below_lower := 0

if condicion_compra4 and barstate.isconfirmed
    consecutive_closes_below_lower := consecutive_closes_below_lower + 1
    if consecutive_closes_below_lower >= 2
        strategy.entry("Compra4", strategy.long, qty=orden4)
        comprado4 := true
        consecutive_closes_below_lower := 0

if condicion_compra5 and barstate.isconfirmed
    consecutive_closes_below_lower := consecutive_closes_below_lower + 1
    if consecutive_closes_below_lower >= 2
        strategy.entry("Compra5", strategy.long, qty=orden5)
        comprado5 := true
        consecutive_closes_below_lower := 0


// Sell conditions
if close > upper  and comprado1 and barstate.isconfirmed
    strategy.close("Compra1")
    comprado1 := false

if close > upper  and comprado2 and barstate.isconfirmed
    strategy.close("Compra2")
    comprado2 := false

if close > upper  and comprado3 and barstate.isconfirmed
    strategy.close("Compra3")
    comprado3 := false

if close > upper and comprado4 and barstate.isconfirmed
    strategy.close("Compra4")
    comprado4 := false

if close > upper and comprado5 and barstate.isconfirmed
    strategy.close("Compra5")
    comprado5 := false