双方向のボリンジャー・バンド・モメンタム・トレーディング・戦略

作者: リン・ハーンチャオチャン開催日:2023年11月16日 17:36時
タグ:

img

概要

この戦略は,ボリンジャーバンドの概念に基づいている.価格チャネルのために上下線を設定し,トレンド判断と取引信号生成のためにそれらを使用する.具体的には,チャネル帯幅として価格の平均絶対偏差を計算する.チャネルの中間線は価格の単純な移動平均線であり,上下線はチャネル帯幅のプラスまたはマイナス1または2倍の中間線である.価格が上下線を突破したとき,ロングに行く.下下線を突破したとき,ショートに行く.

原則

この戦略の主なポイントは以下の通りである.

  1. 価格の中間線を計算します 価格の単純な移動平均線です

  2. チャンネル帯域幅として価格の絶対偏差の単純な移動平均を計算する.

  3. 中間レールと帯域幅に応じて上部と下部レールを決定する.上部レールは中部レールプラス帯域幅の1倍または2倍である.下部レールは中部レールマイナス帯域幅の1倍または2倍である.

  4. トレンド判断指標を計算します. 価格が上線線2を超える場合,それは長線です. 価格が下線2以下の場合,それは短線です.

  5. トレーディング・シグナルを生成します. 価格が上線線2を超えると,ロング,下線2を超えるとショートします.

  6. ストップ損失ラインを設定します.ロングオーダーのストップ損失ラインは下列1で,ショートオーダーの上列1です.

  7. 資本管理要件に従ってポジションサイズを計算する.

この戦略は,トレンドを判断するために移動平均値,オーバーバイトとオーバーセールを判断するためにボリンジャーバンド,逆転を行うためにブレイクアウトを使用するアイデアを統合している.ダブルレールの間の差はトレンドの強さを判断するために使用され,ボリンジャーバンドの回帰関数は比較的安定した取引システムを形成するために利用される.

利点分析

この戦略の主な利点は以下の通りです.

  1. 双列車システムにより 傾向の強さを判断できます

  2. ボリンジャー・バンドは,誤ったブレイクを効果的に防ぐ強力な回帰機能を持っています.

  3. 二重レールの差とボリンジャー帯の回帰が相対的に安定した取引信号を形成する.

  4. リスクをコントロールするための明確なストップ・ロスト/エグジット・ロジックがあります

  5. ポジションのサイズの決定は資本管理の要件に従っており,超負債を避ける.

  6. 戦略のアイデアは明確で理解し最適化するのが簡単です

  7. 柔軟なパラメータ設定により 異なる市場に対応できます

リスク分析

この戦略にはいくつかのリスクもあります:

  1. 不適切なボリンガー帯のパラメータは,価格を効果的に追跡できないため,落札効果を引き起こす可能性があります.

  2. 二重レールの違いは,誤った傾向判断を完全に避けることはできません.

  3. 範囲限定の市場では より多くの無効な信号を生む可能性があります

  4. 誤ったブレイク状況では損失が発生する可能性があります.

  5. 時間の遅れがあり サイクルターニングポイントが欠けている可能性があります

  6. リスク/リターン比はストップ・ロストポイントによって制限され,無制限にトレンドを追いかけることができません.

対応するリスク管理措置:

  1. ボリンジャー帯を異なるサイクルに適応できるようにするパラメータを最適化する.

  2. 誤った判断を避けるため,他の指標を組み合わせて確認してください.

  3. 単一の損失を制御するために ポジションのサイズを減らす.

  4. ストップ・ロスのポイントを最適化して リスク/リターン比を確保する

  5. 遅延を減らすために 適正にサイクルを短縮する

  6. リスク管理は強固で 制限のない追いかけるべきではありません

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

戦略は以下の方向で最適化できる:

  1. より良い価格追跡のためにボリンガー帯のパラメータを最適化します.適応パラメータを導入することができます.

  2. EMAやDWMAなどです.

  3. トレンドフィルタリングを追加して,レンジ・バインド市場での取引を避ける.MACDを考慮することができます.

  4. より多くのトレンド利益を得るために攻撃的な退出方法を追加します. ストップ損失,退出信号などを考慮することができます.

  5. 異なる市場条件に適した組み合わせのための複数の時間枠を導入する.

  6. 誤ったブレイクを避けるために 音量上昇などの追加条件を追加します

  7. 逆ボリンガー帯を考慮してください 上部帯を売り,下部帯を買います

  8. 最適なパラメータ組み合わせのためにパラメータ最適化を実行する.

概要

この戦略の全体的な考え方は明確で安定しています.パラメータ最適化,論理強化,リスク管理などを通じて改善の余地があり,非常に実用的な定量的な取引戦略にさらに精製できます.この戦略は定量的な取引の初心者にとって良い参照を提供します.


/*backtest
start: 2022-11-09 00:00:00
end: 2023-11-15 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/
// © noro

//@version=4
strategy(title = "Noro's Bands Strategy", shorttitle = "Bands", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 0, commission_value = 0.1)

//Sattings
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
lotsize = input(100, defval = 100, minval = 1, maxval = 10000, title = "Lot, %")
len = input(20, defval = 20, minval = 1, maxval = 1000, title = "Length")
src = input(ohlc4, title = "Source")
showbb = input(true, title = "Show Bands")
showof = input(true, title = "Show Offset")
showbg = input(false, title = "Show Background")
fromyear = input(1900, defval = 1900, minval = 1900, maxval = 2100, title = "From Year")
toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year")
frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month")
fromday = input(01, defval = 01, minval = 01, maxval = 31, title = "From day")
today = input(31, defval = 31, minval = 01, maxval = 31, title = "To day")

//PriceChannel
lasthigh = highest(src, len)
lastlow = lowest(src, len)
center = (lasthigh + lastlow) / 2

//Distance
dist = abs(src - center)
distsma = sma(dist, len)
hd = center + distsma
ld = center - distsma
hd2 = center + distsma * 2
ld2 = center - distsma * 2

//Trend
trend = 0
trend := high > hd2 ? 1 : low < ld2 ? -1 : trend[1]
bgcol = showbg == false ? na : trend == 1 ? color.lime : color.red
bgcolor(bgcol, transp = 70)

//Lines
colo = showbb == false ? na : color.black
offset = showof ? 1 : 0
plot(hd2, color = colo, linewidth = 1, transp = 0, offset = offset, title = "High band 2")
plot(hd, color = colo, linewidth = 1, transp = 0, offset = offset, title = "High band 1")
plot(center, color = colo, linewidth = 1, transp = 0, offset = offset, title = "center")
plot(ld, color = colo, linewidth = 1, transp = 0, offset = offset, title = "Low band 1")
plot(ld2, color = colo, linewidth = 1, transp = 0, offset = offset, title = "Low band 2")

//Trading
size = strategy.position_size
needstop = needlong == false or needshort == false
truetime = time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)
lot = 0.0
lot := size != size[1] ? strategy.equity / close * lotsize / 100 : lot[1]
if distsma > 0
    strategy.entry("Long", strategy.long, lot, stop = hd2, when = truetime and needlong)
    strategy.entry("Short", strategy.short, lot, stop = ld2, when = truetime and needshort)
sl = size > 0 ? ld2 : size < 0 ? hd2 : na
if size > 0 and needstop
    strategy.exit("Stop Long", "Long", stop = sl)
if size < 0 and needstop
    strategy.exit("Stop Short", "Short", stop = sl)
if time > timestamp(toyear, tomonth, today, 23, 59)
    strategy.close_all()
    strategy.cancel("Long")
    strategy.cancel("Short")

もっと