
이 전략은 브린 벨트 지표를 기반으로 가격의 상반, 하반, 중반의 움직임에 대한 분석을 통해 최적의 구매 및 판매 기회를 식별합니다. 전략은 다단계 및 빈도 포지션을 동시에 관리하여 다양한 시장 방향에서 수익을 창출할 수 있습니다. 전략의 매개 변수는 다양한 위험 용량과 시장 방식에 맞게 사용자 정의 할 수 있습니다. 전략은 명확한 그래픽 지표와 실시간 구매 및 판매 신호를 제공합니다.
브린밴드 전략은 가격에 대한 브린밴드 움직임에 기반한 정확한 거래 신호를 생성하는 강력한 프레임워크를 제공합니다. 다중 및 공수 포지션 관리, 사용자 정의 파라미터 및 직관적인 시각 및 상기 기능을 통합하여, 이 전략은 거래자가 다양한 시장 조건에서 기회를 자신있게 잡을 수 있도록합니다. 이 전략은 훌륭한 성과에도 불구하고, 추가 지표, 동적 변동율 계산, 강력한 위험 관리 기술 및 시장 상태에 기반한 적응 포지션 조정 등의 최적화 공간이 있습니다.
/*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")