ボリンジャーバンドボリュームトレンドフォロー定量戦略

BB RSI EMA SMA SD SL
作成日: 2024-11-12 15:53:44 最終変更日: 2024-11-12 15:53:44
コピー: 1 クリック数: 459
1
フォロー
1617
フォロワー

ボリンジャーバンドボリュームトレンドフォロー定量戦略

概要

この戦略はブリン帯,RSI指標,移動平均に基づく総合的な取引システムである.戦略は,ブリン帯の価格変動範囲,RSIの超買い超売りレベル,EMAのトレンドフィルタリングによって潜在的な取引機会を識別する.システムは,多額と空白の取引をサポートし,資金の安全を守るための複数の退出機構を提供します.

戦略原則

この戦略は、次のコアコンポーネントに基づいています。

  1. 標準差1.8倍のブリンを使用して価格変動区間を決定する
  2. 7サイクルRSIで 超買いと超売りを判断する
  3. トレンドフィルターとして選択可能な500周期EMA
  4. 応募条件:
    • RSIが25を下回り,ブリンが落ちる
    • RSIが75を超え,ブリン帯を突破して軌道に乗る
  5. RSIの値またはブリン帯の逆転突破を支える退出方法
  6. 選択可能なパーセンテージ・ストロー保護

戦略的優位性

  1. 複数の技術指標の協調により,信号の信頼性が向上
  2. 柔軟なパラメータ設定により,異なる市場状況に応じて調整できます.
  3. 双方向取引を支援し,市場機会を活用する
  4. 異なる取引スタイルに対応する複数の退出メカニズムを提供
  5. トレンドフィルタは偽信号を低減します.
  6. リスクの管理に適した Stop Loss メカニズム

戦略リスク

  1. 不安定な市場では誤ったシグナルが頻繁に発生する可能性がある
  2. 複数のインジケーターにより信号遅延が発生する場合があります
  3. 固定RSIの値は,異なる市場環境で柔軟性がない可能性があります.
  4. ブリン帯のパラメータは,市場の変動に合わせて調整する必要があります.
  5. ストップダメージ設定は,急激な波動で簡単にトリガーされます.

戦略最適化の方向性

  1. 市場波動に動的に調整される自己適応ブリン帯の倍数
  2. 補助確認としてボリュームインジケーターを追加
  3. 特定の時間帯での取引を避けるために時間フィルターを追加することを検討する
  4. 動的RSI値システムを開発
  5. さらに多くのトレンド確認指標を統合する
  6. ダイナミック・ストップの活用を考える

要約する

これは,複数の技術指標の配合によって市場機会を捉えるために設計された量化取引戦略である. 戦略は,異なる取引ニーズに適応する強力な構成性がある. いくつかの固有のリスクがあるものの,パラメータの最適化と補助指標の追加により,その安定性と信頼性がさらに向上することができます.

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

//@version=5
strategy("Bollinger Bands Scalp Pro", overlay=true)

// Inputs for the strategy
length = input(20, title="Bollinger Band Length")
src = input(close, title="Source")
mult = input(1.8, title="Bollinger Band Multiplier")
rsiLength = input(7, title="RSI Length")
rsiOverbought = input(75, title="RSI Overbought Level")
rsiOversold = input(25, title="RSI Oversold Level")

// Custom RSI exit points
rsiExitLong = input(75, title="RSI Exit for Long (Overbought)")
rsiExitShort = input(25, title="RSI Exit for Short (Oversold)")

// Moving Average Inputs
emaLength = input(500, title="EMA Length")
enableEMAFilter = input.bool(true, title="Enable EMA Filter")

// Exit method: Choose between 'RSI' and 'Bollinger Bands'
exitMethod = input.string("RSI", title="Exit Method", options=["RSI", "Bollinger Bands"])

// Enable/Disable Long and Short trades
enableLong = input.bool(true, title="Enable Long Trades")
enableShort = input.bool(false, title="Enable Short Trades")

// Enable/Disable Stop Loss
enableStopLoss = input.bool(false, title="Enable Stop Loss")
stopLossPercent = input.float(1.0, title="Stop Loss Percentage (%)", minval=0.1) / 100

// Bollinger Bands calculation
basis = ta.sma(src, length)
dev = mult * ta.stdev(src, length)
upperBB = basis + dev
lowerBB = basis - dev

// RSI calculation
rsi = ta.rsi(src, rsiLength)

// 200 EMA to filter trades (calculated but only used if enabled)
ema200 = ta.ema(src, emaLength)

// Long condition: RSI below oversold, price closes below the lower Bollinger Band, and optionally price is above the 200 EMA
longCondition = enableLong and (rsi < rsiOversold) and (close < lowerBB) and (not enableEMAFilter or close > ema200)
if (longCondition)
    strategy.entry("Long", strategy.long)

// Short condition: RSI above overbought, price closes above the upper Bollinger Band, and optionally price is below the 200 EMA
shortCondition = enableShort and (rsi > rsiOverbought) and (close > upperBB) and (not enableEMAFilter or close < ema200)
if (shortCondition)
    strategy.entry("Short", strategy.short)

// Stop Loss setup
if (enableStopLoss)
    strategy.exit("Long Exit", "Long", stop = strategy.position_avg_price * (1 - stopLossPercent))
    strategy.exit("Short Exit", "Short", stop = strategy.position_avg_price * (1 + stopLossPercent))

// Exit conditions based on the user's choice of exit method
if (exitMethod == "RSI")
    // Exit based on RSI
    exitLongCondition = rsi >= rsiExitLong
    if (exitLongCondition)
        strategy.close("Long")
    
    exitShortCondition = rsi <= rsiExitShort
    if (exitShortCondition)
        strategy.close("Short")
else if (exitMethod == "Bollinger Bands")
    // Exit based on Bollinger Bands
    exitLongConditionBB = close >= upperBB
    if (exitLongConditionBB)
        strategy.close("Long")
    
    exitShortConditionBB = close <= lowerBB
    if (exitShortConditionBB)
        strategy.close("Short")