이 전략은 평균선, 브린 밴드 및 RSI 지표를 조합하여 가격 추세와 과매매 과매매 현상을 판단하여 거래 기회를 발견합니다. 이 전략은 거래 결정을 높이기 위해 여러 지표의 장점을 통합합니다.
전략적 원칙:
평균선과 그 브린 대역을 계산하여 가격의 중장선 움직임을 판단한다.
RSI를 계산하여 과매매 또는 과매매 상태가 아닌지 판단합니다.
가격이 아래에서 위쪽으로 부린을 돌파하고 RSI가 여러 개의 교차로 나타나면 더 많이하십시오.
가격이 위아래에서 브린을 뚫고 궤도에 올랐을 때, RSI가 하향으로 넘어가면 공백을 다.
단기 손실을 통제하기 위해 스톱 라인을 설정하십시오.
이 전략의 장점:
다중 지표 포트폴리오 검증으로 잘못된 거래의 가능성을 줄일 수 있다.
RSI 지표는 평선 시스템의 결함을 보완할 수 있다.
평선 브린은 돌파점을 식별할 수 있다.
이 전략의 위험은:
다중 지표 조합은 시간이 걸리는 파라미터 최적화를 필요로 한다.
RSI와 부린 띠는 어느 정도 중복되어 있다.
파격적인 거래는 상반되는 결과를 초래할 수 있습니다.
요약하자면, 이 전략은 조합 평균선, 브린 밴드 및 RSI 지표를 통해 추세를 판단하는 동시에 역전 거래 기회를 식별한다. 조합을 사용하여 지표는 효과를 높일 수 있지만, 변수 최적화 문제에 주의를 기울이고 위험을 제어해야합니다.
/*backtest
start: 2023-08-13 00:00:00
end: 2023-09-12 00:00:00
period: 30m
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © LucasVivien
//@version=4
strategy("MA Bolinger Bands + RSI ", shorttitle="MABB + RSI", overlay=true)
// User input
source = input(title="Price source" , type=input.source , defval=close)
RSIlen = input(title="RSI Length" , type=input.integer , defval=6 , group="RSI")
RSIlvlOB = input(title="RSI Overbough" , type=input.integer , defval=50 , group="RSI")
RSIlvlOS = input(title="RSI Oversold" , type=input.integer , defval=50 , group="RSI")
RSIN = input(title="RSI Neutral" , type=input.integer , defval=50 , group="RSI")
MAlen = input(title="MA Length" , type=input.integer , defval=200 , group="MABB")
BBlen = input(title="BB Length" , type=input.integer , defval=200 , group="MABB")
BBmult = input(title="BB multiplier" , type=input.float , defval=2.0 , group="MABB" , tooltip="Set BB closer / appart", minval=0.001, maxval=50)
MAtype = input(title="MA type" , type=input.string , defval="SMA", group="MABB" , tooltip="MA type used in BB", options=["SMA", "EMA", "HMA"])
//SLmult = input(title="SL value" ,type=input.float , defval=0.06)
// Used indicators
RSI = rsi(source, RSIlen)
MA = sma(source, MAlen)
if MAtype == "EMA"
MA := ema(source, MAlen)
if MAtype == "HMA"
MA := hma(source, MAlen)
// Perform Calculations
BBdev = BBmult * stdev(source, BBlen)
BBupper = MA + BBdev
BBlower = MA - BBdev
longSL = close - close * 0.06
shortSL = close + close * 0.06
// Signals validation ([0] is trade displayed from strategy() on chart => long/short entry)
BBbull = (open < BBlower) and (close > BBlower)
BBbear = (open > BBupper) and (close < BBupper)
RSIbull = crossover(RSI , RSIN)
RSIbear = crossunder(RSI, RSIN)
Longsignal = (BBbull) and (RSIbull or RSIbull[1] or
RSIbull[2] or RSIbull[3] or RSIbull[4] or
RSIbull[5] or RSIbull[6] or RSIbull[7] or
RSIbull[8] or RSIbull[9] or RSIbull[10])
Shortsignal = (BBbear) and (RSIbear or RSIbear[1] or
RSIbear[2] or RSIbear[3] or RSIbear[4] or
RSIbear[5] or RSIbear[6] or RSIbear[7] or
RSIbear[8] or RSIbear[9] or RSIbear[10])
// Save SL values
var SLlongsaved = 0.0
var SLshortsaved = 0.0
if Longsignal and (strategy.position_size == -1) ///////////////////////////////
SLlongsaved := longSL
if Shortsignal and (strategy.position_size == 1) ////////////////////////////////
SLshortsaved := shortSL
// Plots
//plotshape(Longsignal , size=size.small, color=color.teal)
//plotshape(Shortsignal, size=size.small, color=color.fuchsia)
plot(Longsignal ? longSL : na, color=color.red, style=plot.style_linebr, linewidth=6)
plot(Shortsignal ? shortSL : na, color=color.red, style=plot.style_linebr, linewidth=6)
p1 = plot(BBupper,title="Bollinger Bands Upper Line", color=color.gray, transp=60)
p2 = plot(BBlower,title="Bollinger Bands Lower Line", color=color.gray, transp=60)
plot(MA, title="Bollinger Bands MA Basis Line" , color=color.white, transp=50)
fill(p1, p2, color=color.white, transp=92)
// Strategy Entry & Exit
//if Longsignal
strategy.entry(id="Long entry", long=true, when=Longsignal) //, oca_name="x", oca_type=strategy.oca.cancel)
//if Shortsignal
strategy.entry(id="Short entry", long=false, when=Shortsignal) //, oca_name="x", oca_type=strategy.oca.cancel)
strategy.close(id="Long exit", when=strategy.position_size > 0)//, from_entry="Long entry" //, when=strategy.position_size > 0 // , stop=SLlongsaved)
strategy.close(id="Short Exit", when=strategy.position_size < 0)//, from_entry="Short entry" //, when=strategy.position_size < 0 //, stop=SLshortsaved)
plot(strategy.position_size) //////////////////////////////////////////////