
この戦略は,ブリン帯の指標に基づいた改良版のトレンド追跡戦略である.これは,価格とブリン帯の連続3回の接触を監視することで,トレンドの信頼性を確認し,それにより高い勝率で取引する.この戦略は,20周期の移動平均を中道として使用し,上下線の計算基準として標準差の2倍を使用する.価格とブリン帯の境界との関係を深く分析することで,独特の優位性を有する取引システムを実現する.
策略の核心的な論理は,計数機構によって,価格がブリン帯の境界に継続的に触れていることを認識することです.価格が連続して3回下線を突破すると,システムは複数の信号を発信します.価格が連続して3回上線を突破すると,システムは空の信号を発信します.このメカニズムは,偽の突破を効果的にフィルターし,取引の信頼性を高めます.策略はブリン帯の中央軌道 (20期移動平均線) を平仓信号として使用し,価格が中央軌道に戻ると取引を完了します.この設計は,トレンドの把握を保証するだけでなく,利益を間に合わせてロックすることができます.
この戦略は,従来のブリン帯取引システムを改良することで,より高い信頼性を有するトレンド追跡戦略を実現した.その独特のトリプルタッチ確認機構は,取引の勝率を効果的に高め,移動平均に基づく平仓機構は,合理的な利益を得た結末方案を提供した.戦略には依然としていくつかの固有のリスクがあるが,最適化方向を提供することで,戦略の安定性と収益性をさらに向上させることができる.
/*backtest
start: 2024-11-10 00:00:00
end: 2024-12-09 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("Bollinger Bands Strategy - 3 Crossings", overlay=true)
// Input Parameters
length = input.int(20, title="Bollinger Bands Length", minval=1)
src = input(close, title="Source")
mult = input.float(2.0, title="Multiplier", step=0.1)
// Calculate Bollinger Bands
basis = ta.sma(src, length)
dev = mult * ta.stdev(src, length)
upper = basis + dev
lower = basis - dev
// Plot Bollinger Bands
plotBasis = plot(basis, color=color.blue, title="Basis")
plotUpper = plot(upper, color=color.red, title="Upper Band")
plotLower = plot(lower, color=color.green, title="Lower Band")
fill(plot1=plotUpper, plot2=plotLower, color=color.new(color.blue, 90), title="Band Fill")
// Counter Variables
var int longCrossCount = 0
var int shortCrossCount = 0
// Detect Crossings
longCondition = close < lower // Price closes below the lower band
shortCondition = close > upper // Price closes above the upper band
if longCondition
longCrossCount += 1 // Increment the counter for long
shortCrossCount := 0 // Reset the short counter
if shortCondition
shortCrossCount += 1 // Increment the counter for short
longCrossCount := 0 // Reset the long counter
if not longCondition and not shortCondition
longCrossCount := 0 // Reset if no crossing
shortCrossCount := 0
// Entry and Exit Rules
if longCrossCount >= 3 and strategy.position_size <= 0
strategy.entry("Long", strategy.long)
longCrossCount := 0 // Reset the counter after entering
if shortCrossCount >= 3 and strategy.position_size >= 0
strategy.entry("Short", strategy.short)
shortCrossCount := 0 // Reset the counter after entering
// Exit Condition (When Price Returns to the Middle Band)
exitCondition = ta.crossover(src, basis) or ta.crossunder(src, basis)
if exitCondition and strategy.position_size > 0
strategy.close("Long")
if exitCondition and strategy.position_size < 0
strategy.close("Short")