
この戦略はブリン帯指数に基づいており,上位,下位,中位相対の価格の動きを分析することによって,最適な買入機会を識別する. この戦略は,多頭と空頭のポジションを同時に管理し,さまざまな市場方向から利益を得ることを可能にします. この戦略のパラメータは,異なるリスク承受能力と市場方法に対応するためにカスタマイズできます.
ブリンベルト戦略は,価格とブリンベルトの相対的な動きに基づいて正確な取引シグナルを生成するための強力な枠組みを提供します. 多頭と空頭のポジション管理,カスタマイズされたパラメータ,および直感的な視覚と警告機能を統合することにより,この戦略は,さまざまな市場条件下で,トレーダーに自信を持ってチャンスを掴むことを可能にします. この戦略は,優れたパフォーマンスを発揮しているにもかかわらず,追加の指標,ダイナミックな変動率の計算,強力なリスク管理技術,市場状況に基づく自主的なポジション調整の導入などの最適化のための余地があります.
/*backtest
start: 2024-04-01 00:00:00
end: 2024-04-30 23:59:59
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Bollinger Bands Strategy with Long and Short", overlay=true)
// Bollinger Bands settings
length = input.int(20, title="BB Length")
src = input(close, title="Source")
mult = input.float(2.0, title="BB Multiplier")
// Calculate Bollinger Bands
basis = ta.sma(src, length)
dev = mult * ta.stdev(src, length)
upper = basis + dev
lower = basis - dev
// Plot Bollinger Bands
plot(basis, color=color.blue, linewidth=1, title="Basis")
p1 = plot(upper, color=color.red, linewidth=1, title="Upper Band")
p2 = plot(lower, color=color.green, linewidth=1, title="Lower Band")
fill(p1, p2, color=color.rgb(173, 216, 230, 90))
// Long Buy and Sell conditions
buyConditionLower = ta.crossover(src, lower)
sellConditionUpper = ta.crossunder(src, upper)
buyConditionBasis = ta.crossover(src, basis)
sellConditionBasis = ta.crossunder(src, basis)
// Combine long conditions
buyCondition = buyConditionLower or buyConditionBasis
sellCondition = sellConditionUpper or sellConditionBasis
// Short Sell and Buy conditions
shortConditionUpper = ta.crossunder(src, upper)
coverConditionLower = ta.crossover(src, lower)
shortConditionBasis = ta.crossunder(src, basis)
coverConditionBasis = ta.crossover(src, basis)
// Combine short conditions
shortCondition = shortConditionUpper or shortConditionBasis
coverCondition = coverConditionLower or coverConditionBasis
// Execute strategy orders for long
if (buyCondition)
strategy.entry("Long", strategy.long)
if (sellCondition)
strategy.close("Long")
// Execute strategy orders for short
if (shortCondition)
strategy.entry("Short", strategy.short)
if (coverCondition)
strategy.close("Short")
// Plot Buy and Sell signals for long
plotshape(series=buyCondition, location=location.belowbar, color=color.green, style=shape.labelup, text="BUY", title="Buy Signal")
plotshape(series=sellCondition, location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL", title="Sell Signal")
// Plot Sell and Cover signals for short
plotshape(series=shortCondition, location=location.abovebar, color=color.red, style=shape.labeldown, text="SHORT", title="Short Signal")
plotshape(series=coverCondition, location=location.belowbar, color=color.green, style=shape.labelup, text="COVER", title="Cover Signal")
// Alert conditions for long
alertcondition(buyCondition, title="Buy Alert", message="Price crossed above the lower Bollinger Band or Basis")
alertcondition(sellCondition, title="Sell Alert", message="Price crossed below the upper Bollinger Band or Basis")
// Alert conditions for short
alertcondition(shortCondition, title="Short Alert", message="Price crossed below the upper Bollinger Band or Basis")
alertcondition(coverCondition, title="Cover Alert", message="Price crossed above the lower Bollinger Band or Basis")