
이 전략은 브린 밴드, 상대적으로 약한 지수 ((RSI) 와 상품 경로 지수 ((CCI) 의 세 가지 지표를 사용하여 교차 신호를 찾고 구매 및 판매 신호를 발령합니다. 이 전략은 시장의 과매매 과매매 현상을 발견하고 전환점에 진입하여 더 나은 투자 수익을 얻으려는 것입니다.
브린 띠는 중간 궤도, 상단 궤도, 하단 궤도로 구성된다. 중간 궤도는 일반적으로 20 일 이동 평균을 사용합니다. 상단 궤도와 하단 궤도는 각각 중간 궤도 위와 아래의 두 가지 표준 차이의 위치입니다. 가격이 하단 궤도에 접근하면 과매 신호로 간주됩니다. 가격이 상단 궤도에 접근하면 과매 신호로 간주됩니다.
RSI 지표는 종결 가격의 상승과 하락의 속도 변화를 반영하며, 구매와 판매의 힘을 측정하기 위해 사용된다. RSI 값은 0에서 30까지 오버솔 지역이며, 70에서 100까지 오버솔 지역이다. RSI가 오버솔 지역에서 떨어지면 판매 신호로 사용할 수 있고, RSI가 오버솔 지역에서 상승하면 구매 신호로 사용할 수 있다.
CCI 지표는 주식 가격의 평균 가격에서 벗어난 정도를 측정하기 위해 사용된다. 그 중 +100은 가격보다 훨씬 높은 가격을 나타내고, 과매매한다. -100은 가격보다 훨씬 낮은 가격을 나타내고, 과매매한다. CCI는 가격의 극단적인 상황을 반영할 수 있다.
이 전략은 부린띠를 사용하여 가격이 단기간에 과매매를 초과하는지 여부를 판단하고, RSI 지표를 사용하여 거래 포트 파워의 균형을 판단하고, CCI 지표를 사용하여 가격의 편차 정도를 판단합니다. 부린띠, RSI 및 CCI 지표가 동시에 구매 / 판매 신호를 제공하면 거래 지시가 발령됩니다.
이 전략은 종합적으로 단기, 중기 및 장기 시장 상황을 고려하고, 브린 밴드, RSI 및 CCI의 세 지표의 교차 신호를 통해 시장 역전의 시기를 판단하며, 보다 안정적인 역전 추적 전략에 속한다. 파라미터 조정, 정지 방식 등으로 추가적으로 최적화 할 수 있으며, 여러 가지 시장 환경에 적합하다.
/*backtest
start: 2023-11-19 00:00:00
end: 2023-12-19 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy(shorttitle="BBRSIstr", title="Bollinger Bands", overlay=true)
length = input.int(20, minval=1)
maType = input.string("SMA", "Basis MA Type", options = ["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"])
src = input(close, title="Source")
mult = input.float(2.0, minval=0.001, maxval=50, title="StdDev")
ma(source, length, _type) =>
switch _type
"SMA" => ta.sma(source, length)
"EMA" => ta.ema(source, length)
"SMMA (RMA)" => ta.rma(source, length)
"WMA" => ta.wma(source, length)
"VWMA" => ta.vwma(source, length)
basis = ma(src, length, maType)
dev = mult * ta.stdev(src, length)
upper = basis + dev
lower = basis - dev
offset = input.int(0, "Offset", minval = -500, maxval = 500)
plot(basis, "Basis", color=#FF6D00, offset = offset)
p1 = plot(upper, "Upper", color=#2962FF, offset = offset)
p2 = plot(lower, "Lower", color=#2962FF, offset = offset)
fill(p1, p2, title = "Background", color=color.rgb(33, 150, 243, 95))
//RSI
rsiLengthInput = input.int(14, minval=1, title="RSI Length", group="RSI Settings")
rsiSourceInput = input.source(close, "Source", group="RSI Settings")
maTypeInput = input.string("SMA", title="MA Type", options=["SMA", "Bollinger Bands", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="MA Settings")
maLengthInput = input.int(14, title="MA Length", group="MA Settings")
bbMultInput = input.float(2.0, minval=0.001, maxval=50, title="BB StdDev", group="MA Settings")
showDivergence = input.bool(false, title="Show Divergence", group="RSI Settings")
up = ta.rma(math.max(ta.change(rsiSourceInput), 0), rsiLengthInput)
down = ta.rma(-math.min(ta.change(rsiSourceInput), 0), rsiLengthInput)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
rsiMA = ma(rsi, maLengthInput, maTypeInput)
isBB = maTypeInput == "Bollinger Bands"
rsiPlot = plot(rsi, "RSI", color=#7E57C2)
plot(rsiMA, "RSI-based MA", color=color.yellow)
rsiUpperBand = hline(70, "RSI Upper Band", color=#787B86)
midline = hline(50, "RSI Middle Band", color=color.new(#787B86, 50))
rsiLowerBand = hline(30, "RSI Lower Band", color=#787B86)
fill(rsiUpperBand, rsiLowerBand, color=color.rgb(126, 87, 194, 90), title="RSI Background Fill")
//cci
ma = ta.sma(src, length)
cci = (src - ma) / (0.015 * ta.dev(src, length))
plot(cci, "CCI", color=#2962FF)
band1 = hline(100, "Upper Band", color=#787B86, linestyle=hline.style_dashed)
hline(0, "Middle Band", color=color.new(#787B86, 50))
band0 = hline(-100, "Lower Band", color=#787B86, linestyle=hline.style_dashed)
fill(band1, band0, color=color.rgb(33, 150, 243, 90), title="Background")
typeMA = input.string(title = "Method", defval = "SMA", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="Smoothing")
smoothingLength = input.int(title = "Length", defval = 5, minval = 1, maxval = 100, group="Smoothing")
smoothingLine = ma(cci, smoothingLength, typeMA)
plot(smoothingLine, title="Smoothing Line", color=#f37f20, display=display.none)
longCBB= close < lower
shortCBB = close>upper
longBRSI = rsi < 33
shortBRSI = rsi > 70
longcci = cci < -215
shortcci = cci > 250
strategy.entry("LONG", strategy.long, when = longCBB and longBRSI and longcci)
strategy.exit("Exit ", profit = 600)
strategy.entry("SHORT", strategy.short, when = shortCBB and shortBRSI and shortcci)
strategy.exit("Exit ", profit = 600)