
이것은 부린 띠 지표에 기반한 거래 전략으로, 가격과 부린 띠의 교차 관계를 통해 시장의 흐름을 식별하고 거래 신호를 생성한다. 이 전략은 55주기의 이동 평균을 부린 띠의 중간 궤도로 사용하며, 1.0배의 표준 차이는 부린 띠의 상하 궤도로 계산된다. 이 전략의 핵심은 부린 띠의 상하 궤도를 돌파하여 장과 공백 시간을 결정하는 것이다.
전략의 작동 원리는 다음과 같은 몇 가지 핵심 부분을 포함합니다.
이것은 부린띠에 기반한 고전적인 트렌드 추적 전략으로, 가격과 부린띠의 교차 관계를 통해 시장 트렌드를 포착한다. 전략 설계는 간결하고 명확하며, 좋은 시각화 효과와 신호 생성 메커니즘을 가지고 있다. 흔들리는 시장에서 도전을 받을 수 있지만, 적절한 매개 변수 최적화와 보조 지표를 추가하면 전략의 안정성과 신뢰성을 더욱 향상시킬 수 있다.
/*backtest
start: 2024-02-19 00:00:00
end: 2025-02-16 08:00:00
period: 2h
basePeriod: 2h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Bollinger Bands Filter [Strategy]", overlay=true)
// -- INPUTS (kratke tooltipy, ziadne prelomenie riadku)
src = input.source(close, title="Source", tooltip="Source for BB calc")
length = input.int(55, minval=1, title="SMA length", tooltip="Period for BB basis")
mult = input.float(1.0, minval=0.1, maxval=5, title="Std Dev", tooltip="Std Dev multiplier")
CC = input.bool(true, "Color Bars", tooltip="If true, color bars by BB logic")
// -- Bollinger calc
basis = ta.sma(src, length)
dev = mult * ta.stdev(src, length)
upper = basis + dev
lower = basis - dev
// -- Long/Short logic
longCondition = close > upper
shortCondition = close < lower
L1 = ta.barssince(longCondition)
S1 = ta.barssince(shortCondition)
longSignal = L1 < S1 and not (L1 < S1)[1]
shortSignal = S1 < L1 and not (S1 < L1)[1]
// -- Plot signals
plotshape(shortSignal ? close : na, color=color.red, style=shape.triangledown, size=size.small, location=location.abovebar, title="Short Signal")
plotshape(longSignal ? close : na, color=color.green, style=shape.triangleup, size=size.small, location=location.belowbar, title="Long Signal")
// -- Plot BB lines
plot(upper, color=color.new(color.red, 40), title="Upper BB")
plot(lower, color=color.new(color.green,40), title="Lower BB")
plot(basis, color=color.new(color.blue, 10), title="Basis")
// -- Fill
fill(plot(na), plot(na)) // 'dummy' fill reset
fill(plot(upper, display=display.none), plot(basis, display=display.none), color=color.new(color.teal, 80))
fill(plot(lower, display=display.none), plot(basis, display=display.none), color=color.new(color.orange, 80))
// -- barcolor
bcol = close > upper ? color.lime : close < lower ? color.red : na
barcolor(CC ? bcol : na)
// -- Alerts
alertcondition(longSignal, title="Long - BB", message="BB Filter Long")
alertcondition(shortSignal, title="Short - BB", message="BB Filter Short")
// -- Strategy entries
if longSignal
strategy.entry("Long", strategy.long)
if shortSignal
strategy.entry("Short", strategy.short)