
Данная стратегия представляет собой адаптивную торговую систему разворота тренда, основанную на индикаторе полос Боллинджера. Он фиксирует возможности перекупленности и перепроданности на рынке, отслеживая пересечение цен и полос Боллинджера, и торгует на основе принципа возврата к среднему. Стратегия использует механизмы динамического управления позициями и контроля рисков и применима к различным рынкам и периодам времени.
Основная логика стратегии основана на следующих пунктах:
Риск волатильности рынка. Частая торговля на боковом рынке может привести к убыткам. Решение: добавьте фильтр тренда и торгуйте только тогда, когда тренд очевиден.
Риск ложного прорыва — цены могут быстро развернуться после прорыва. Решение: добавьте подтверждающие сигналы, такие как объем или другие технические индикаторы.
Систематический риск — вероятность крупных потерь в экстремальных рыночных условиях. Решение: Установите максимальный лимит просадки и автоматически прекратите торговлю при достижении порогового значения.
Эта стратегия использует индикатор полос Боллинджера для фиксации отклонений цен и объединяет его с принципом возврата к среднему для торговли. Идеальный механизм контроля рисков и четкие правила торговли делают его очень практичным. Стабильность и прибыльность стратегии могут быть дополнительно улучшены за счет рекомендуемых направлений оптимизации. Стратегия подходит для количественных трейдеров, стремящихся к стабильной прибыли.
/*backtest
start: 2025-01-09 00:00:00
end: 2025-01-16 00:00:00
period: 10m
basePeriod: 10m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT","balance":49999}]
*/
//@version=5
strategy("Bollinger Bands Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=200)
// Inputs for Bollinger Bands
bbLength = input.int(20, title="Bollinger Bands Length")
bbStdDev = input.float(2.0, title="Bollinger Bands StdDev")
// Inputs for Risk Management
stopLossPerc = input.float(1.0, title="Stop Loss (%)", minval=0.1, step=0.1)
takeProfitPerc = input.float(2.0, title="Take Profit (%)", minval=0.1, step=0.1)
// Calculate Bollinger Bands
basis = ta.sma(close, bbLength)
bbStdev = ta.stdev(close, bbLength)
upper = basis + bbStdDev * bbStdev
lower = basis - bbStdDev * bbStdev
// Plot Bollinger Bands
plot(basis, color=color.blue, title="Middle Band")
plot(upper, color=color.red, title="Upper Band")
plot(lower, color=color.green, title="Lower Band")
// Entry Conditions
longCondition = ta.crossover(close, lower)
shortCondition = ta.crossunder(close, upper)
// Exit Conditions
exitLongCondition = ta.crossunder(close, basis)
exitShortCondition = ta.crossover(close, basis)
// Stop Loss and Take Profit Levels
longStopLoss = close * (1 - stopLossPerc / 100)
longTakeProfit = close * (1 + takeProfitPerc / 100)
shortStopLoss = close * (1 + stopLossPerc / 100)
shortTakeProfit = close * (1 - takeProfitPerc / 100)
// Execute Long Trades
if (longCondition)
strategy.entry("Long", strategy.long)
strategy.exit("Exit Long", from_entry="Long", stop=longStopLoss, limit=longTakeProfit)
if (shortCondition)
strategy.entry("Short", strategy.short)
strategy.exit("Exit Short", from_entry="Short", stop=shortStopLoss, limit=shortTakeProfit)
// Close Positions on Exit Conditions
if (exitLongCondition and strategy.position_size > 0)
strategy.close("Long")
if (exitShortCondition and strategy.position_size < 0)
strategy.close("Short")
// 🔊 SOUND ALERTS IN BROWSER 🔊
if (longCondition)
alert("🔔 Long Entry Signal!", alert.freq_once_per_bar_close)
if (shortCondition)
alert("🔔 Short Entry Signal!", alert.freq_once_per_bar_close)
if (exitLongCondition)
alert("🔔 Closing Long Trade!", alert.freq_once_per_bar_close)
if (exitShortCondition)
alert("🔔 Closing Short Trade!", alert.freq_once_per_bar_close)