
이 전략은 부린 띠 지표 디자인에 기반하여, 가격이 부린 띠를 돌파할 때 공백을 하고, 경로를 돌파할 때 더 많이 하고, 거래를 지능적으로 추적한다.
이 전략은 브린 띠의 중선, 상반도, 하반도 기반 지표를 사용한다. 중선은 n일 종결 가격의 이동 평균이며, 상반도는 중선 상의 편차 두 표준 차이를 나타내고, 하반도는 중선 아래의 편차 두 표준 차이를 나타낸다. 가격이 하반도 순서에서 지나갈 때, 더 많은 것을 하고, 가격이 상반도 순서에서 지나갈 때, 공백을 한다. 이렇게하면 시장의 변동성에 따라 가격을 지능적으로 추적할 수 있다.
특히, 전략은 두 가지 지표에 의해 판단됩니다.
ta.crossover ((source, lower): 종전 가격에서 트레일 아래로 돌고, 더 많이 한다
ta.crossunder ((source, upper): 종전 가격 아래로 궤도를 돌고, 공백
평정상황을 촉발할 때, strategy.cancel () 함수를 사용하여 현재 지분을 평정한다.
이 전략은 다음과 같은 장점을 가지고 있습니다.
이 전략에는 몇 가지 위험도 있습니다.
대응방법:
이 전략은 더욱 개선될 수 있습니다.
이 전략은 브린 띠 지표 디자인에 기반하여 가격 돌파 위아래 방식을 사용하여 자동 추적을 구현한다. 전략은 간단하고 이해하기 쉽고, 시장의 변동성에 민감하며, 파라미터 최적화 및 스톱 로즈 방식으로 효과를 더욱 최적화 할 수 있다. 전반적으로 이 전략은 변동성이 높은 주식 지수 또는 상품 시장에 적합하다. 거래자는 자신의 거래 선호도에 따라 적절한 품종과 파라미터를 선택하여 재검토를 수행하고 최적화 할 수 있습니다.
/*backtest
start: 2023-12-17 00:00:00
end: 2024-01-16 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Bollinger Bands Strategy with alerts (incl. pending orders) via TradingConnector to Forex", overlay=true)
source = close
length = input.int(20, minval=1)
mult = input.float(2.0, minval=0.001, maxval=50)
basis = ta.sma(source, length)
dev = mult * ta.stdev(source, length)
upper = basis + dev
lower = basis - dev
buyEntry = ta.crossover(source, lower)
sellEntry = ta.crossunder(source, upper)
if (ta.crossover(source, lower))
strategy.entry("BBandLE", strategy.long, stop=lower, oca_name="BollingerBands", comment="BBandLE")
alert(message='long price='+str.tostring(lower), freq=alert.freq_once_per_bar_close)
else
strategy.cancel(id="BBandLE")
alert(message='cancel long', freq=alert.freq_once_per_bar_close)
if (ta.crossunder(source, upper))
strategy.entry("BBandSE", strategy.short, stop=upper, oca_name="BollingerBands", comment="BBandSE")
alert(message='short price='+str.tostring(upper), freq=alert.freq_once_per_bar_close)
else
strategy.cancel(id="BBandSE")
alert(message='cancel short', freq=alert.freq_once_per_bar_close)
//plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)
//Lines of code added to the original built-in script: 14, 17, 20 and 23 only.
//They trigger alerts ready to be executed on real markets through TradingConnector
//available for Forex, indices, crypto, stocks - anything your broker offers for trading via MetaTrader4/5