
この戦略は,ブリン帯を買賣信号として利用し,価格が下線を突破するときに買い,上線を突破するときに売る.また,ピラミッド式加仓方法を使用し,所持数が設定値を下回ると買い続け,設定値を下回ると売る.この戦略は,明らかに傾向のある市場情勢に適用される.
ブリン帯の突破策は,価格のブリン帯の位置に対してトレンド追跡信号を生成し,同時にピラミッド加仓によってトレンド収益を拡大する.しかし,震動的な市場では不良なパフォーマンスを発揮し,ピラミッド加仓は損失を拡大する可能性がある.したがって,実際の適用では,他の指標の検証信号と組み合わせ,加仓リスクを制御し,パラメータを最適化する必要があります.同時に,市場の特徴に応じて戦略を柔軟に調整する必要があります.
/*backtest
start: 2023-04-19 00:00:00
end: 2024-04-24 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Bollinger Bands Breakout Strategy", overlay=true, initial_capital=100, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// Définition des paramètres
length = input(20, title="Bollinger Bands Length")
multiplier = input(2.0, title="Multiplier")
pyramiding = input(10, title="Pyramiding")
// Calcul des bandes de Bollinger
basis = ta.sma(close, length)
dev = multiplier * ta.stdev(close, length)
upper_band = basis + dev
lower_band = basis - dev
// Règles d'entrée
buy_signal = close <= lower_band
sell_signal = close >= upper_band
// Gestion des positions
if (buy_signal)
strategy.entry("Buy", strategy.long)
if (sell_signal)
strategy.entry("Sell", strategy.short)
// Pyramiding
if (strategy.opentrades < pyramiding)
strategy.entry("Buy", strategy.long)
else if (strategy.opentrades > pyramiding)
strategy.entry("Sell", strategy.short)
// Tracé des bandes de Bollinger
plot(basis, color=color.blue)
plot(upper_band, color=color.red)
plot(lower_band, color=color.green)