가격 돌파 볼린저 밴드 A 전략


생성 날짜: 2023-11-06 11:43:14 마지막으로 수정됨: 2023-11-06 11:43:14
복사: 0 클릭수: 398
1
집중하다
1212
수행원

가격 돌파 볼린저 밴드 A 전략

개요

이 전략은 부린 라인 지표의 변동폭을 사용하여 K 라인 형태와 결합하여 가격 돌파 작업을 수행한다. 부린 라인의 위아래 궤도는 가격의 상승 및 하락 경향을 대략적으로 판단할 수 있으며, K 라인 형태 지표와 결합하면 보다 명백한 매매 시기를 찾을 수 있다. 이 전략은 주로 부린 라인의 하래 궤도 돌파를 판단하고, 상반 궤도 돌파는 공백을 만들며, 동시에 스토흐 지표와 결합하여 오버 바이 오버 시트 상태를 판단하고, K 라인 형태를 사용하여 선택적 매매 신호를 제공한다.

전략 원칙

이 전략은 주로 다음과 같은 몇 가지 지표로 구성됩니다.

  1. 부린 라인 지표는 부린 라인의 중간 레일, 상단 레일, 하단 레일을 포함한다. 부린 라인은 가격의 표준 차이를 통해 가격의 변동 범위를 계산하여 가격의 변동 동향을 판단한다.

  2. Stoch 지표, 주식이 과매매 상태인지 판단한다. K선과 D선으로 상향 돌파와 하향 돌파를 판단한다.

  3. K선 형태, 일반적인 대양선, 대양선 등의 형태를 판단하여 대안으로 구매할 수 있는 시간이다.

구매 조건: 가격이 부린 선 아래로 올라가고, 스토흐 지표가 과매매 (K<20, D<20) 를 나타내고, 빠른 이동 평균선이 느린 이동 평균선을 상향으로 돌파한다.

판매 조건: 가격 아래에서 브린을 뚫고 온라인에 올릴 수 있고, 수익 후 손실을 감수할 수 있다.

이 전략은 동시 트렌드 분석과 과매매 판단을 결합하여 ecausefalse의 승률을 낮추고, 트렌드가 발생했을 때 시장에 적시에 들어갈 수 있다. 그러나, 적시에 스톱 손실을 필요로 하는 피팅의 위험도 존재한다.

우위 분석

  1. 부린 라인과 스토흐 지표와 결합하여 주가가 눈에 띄게 낮아지면 구매할 수 있어 위험을 줄일 수 있다.

  2. K선형은 진동상황에서 잘못 구매하는 것을 피하기 위한 보조 조건이다.

  3. 이 두 가지 조건으로 판단하는 것은 전략의 안정성과 신뢰성을 높여줍니다.

  4. 손해배상 제도는 큰 손실을 방지할 수 있습니다.

위험 분석

  1. 브린라인 거래에서는 쉽게 속일 수 있다. 시장이 분열되면 큰 손실이 발생할 수 있다.

  2. 스토치 지표는 잘못된 신호를 발산할 확률이 높으며, 스토치 단독으로 사용하면 손실 위험이 높다.

  3. “이런 일이 벌어질 때, 우리는 ‘이런 일이 벌어질 수 있다’고 생각해야 합니다.

  4. 적당한 시기에 손실을 막고 위험을 통제해야 합니다.

  5. 하지만, 이 강도에서 돌파하는 것을 막기 위해서는 돌파의 강도에 주의해야 합니다.

최적화 방향

  1. 주식 풀을 최적화하여 변동이 큰, 트렌드가 뚜렷한 주식을 선택하십시오.

  2. 부린 라인 파라미터를 최적화하고, 중궤도 주기를 조정하고, 매매 지점을 최적화한다.

  3. 스토흐 변수를 최적화하고, K선과 D선 주기를 조정하여 지표 신뢰도를 높인다.

  4. 거래량을 늘리고, 급격한 하락을 피하기 위한 조건적 판단

  5. 손실을 통제하기 위해 추적 중지, 이동 중지와 같은 손실을 방지하는 전략을 추가하십시오.

  6. 다른 기술 지표들, 예를 들어 MACD, KDJ를 추가하여 전략의 안정성을 높이는 것을 평가한다.

  7. 포지션 보유 기간의 차이를 테스트하고 수익 회수율을 최적화합니다.

요약하다

이 전략은 부린 라인, 스토흐 지표와 기본 기술 지표를 통합하여 위험을 통제하는 전제 하에 주가 저점에서 구매하고, 역사적 고점 근처에 판매하여 비교적 안정적인 수익 모드를 달성합니다. 그러나, 가축, 손실 차단 효과와 같은 위험도 있습니다. 파라미터를 최적화하고 다른 판단 지표를 추가함으로써 전략의 안정성과 지속적인 수익성을 더욱 향상시킬 수 있습니다. 이 전략은 주가 오버 바이 오버 셀 지역의 흔들림 중에 거래하는 전략 투자자를 판단하는 데 적합합니다.

전략 소스 코드
/*backtest
start: 2023-10-29 00:00:00
end: 2023-11-03 18:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=3
strategy("Bollinger e Tendência", overlay=true)

//MÉDIAS 
periodolenta = 14
periodosimples = 47
periodome = 7

psimples = input(title="Período da média simples", defval=periodosimples)
pexp = input(title="Período da média exponencial", defval=periodome)
pexplenta = input(title="Período da média exp lenta", defval=periodolenta)
msimples = sma(close, psimples)
mexp = ema(close, pexp)
mexplenta = ema(close, pexplenta)

plot(msimples, linewidth=2, color=yellow)
plot(mexp, linewidth=5, color=white)
plot(mexplenta, linewidth=2, color=orange)

//BOLLANGER
length = input(21, minval=2)
src = input(close, title="Source")
mult = input(1.5, minval=0.001, maxval=50)
basis = sma(src, length)
dev = mult * stdev(src, length)
upperBol = basis + dev
lowerBol = basis - dev

p1 = plot(upperBol, title="Upper", color=blue, linewidth=3)
p2 = plot(lowerBol, title="Lower", color=blue, linewidth=3)
fill(p1, p2, color = purple, transp=90)

//BBW (altura do Bollanger)
basis2 = sma(close, 21)
bbw = (upperBol-lowerBol)/basis2


//STOCH E FORÇA
source = close
lengthRSI = input(11, minval=2), lengthStoch = input(7, minval=2)
smoothK = input(3,minval=3), smoothD = input(4,minval=3)
OverSold = input(20), OverBought = input(80)
rsi1 = rsi(source, lengthRSI)
k = sma(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
d = sma(k, smoothD)
hline(OverSold,color=blue)
hline(OverBought,color=blue)



// Cor das Tendências (Verde ou Vermelho)
// Baseado no código: "Pivot Daily Price Color" (by Rimko)
pivot = (high + low + close ) / 3.0 
dtime_pivot = request.security(syminfo.tickerid, 'D', pivot[1]) 
pv = dtime_pivot ? dtime_pivot : na
pe = ema(close,periodome)
col = sma(close,1)>pv?green:red
col2 = sma(close,1)>pe?green:red
offs_daily = 0 
pp=plot(pv, title="Daily Pivot",style=linebr, color=black,linewidth=2) 
p=plot(sma(close,1), transp=100, editable=false)
pema = plot(pe, title="EMA",style=line, color=black,linewidth=2, transp = 50)
fill(p,pema,color=col2,title="EMA to price color", transp = 50)
fill(pp,p,color=col, title="Privot to price color", transp = 90) 


//*************************************************************************************************************************************************
// Candles (identificação):
// Baseado no código: "Candlesticks Pattern Identified" (by Repo32)
trend= input(5, minval=1, title="Trend in Bars")

DojiSize = input(0.05, minval=0.01, title="Doji size")
data=(abs(open - close) <= (high - low) * DojiSize)
//plotchar(data, title="Doji", color=white)
plotshape(data, title="Doji", color=white, style=shape.cross)
 //text='Doji'

data6=(close[1] > open[1] and open > close and open <= close[1] and open[1] <= close and open - close < close[1] - open[1] and open[trend] < open)
plotshape(data6, title= "Bearish Harami", color=red, style=shape.triangledown)
//, text="Harami\nde Baixa"

data8=(close[1] > open[1] and open > close and open >= close[1] and open[1] >= close and open - close > close[1] - open[1] and open[trend] < open)
plotshape(data8,  title= "Bearish Engulfing", color=red, style=shape.triangledown)
//, text="Engolfo\nde Baixa"

data13=(open[1]<close[1] and open<=open[1] and close<=open and open[trend] < open)
plotshape(data13, title= "Bearish Kicker", color=red, style=shape.triangledown)
//, text="Kicker\nde Baixa"

data14=(((high-low>4*(open-close))and((close-low)/(.001+high-low)>=0.75)and((open-low)/(.001+high-low)>=0.75))and open[trend] < open and high[1] < open and high[2] < open)
plotshape(data14,  title= "Hanging Man", location=location.belowbar, color=red, style=shape.triangledown)
//, text="Enforcado"

data7=(open[1] > close[1] and close > open and close <= open[1] and close[1] <= open and close - open < open[1] - close[1] and open[trend] > open)
plotshape(data7,  title= "Bullish Harami", location=location.belowbar, color=lime, style=shape.triangleup)
//, text="Mulher\nGrávida"

data9=(open[1] > close[1] and close > open and close >= open[1] and close[1] >= open and close - open > open[1] - close[1] and open[trend] > open)
plotshape(data9, title= "Bullish Engulfing", location=location.belowbar, color=lime, style=shape.triangleup)
//, text="Engolfo\nde Alta"

//uppercandle = highest(10)[1]
data10=(close[1] < open[1] and  open < low[1] and close > close[1] + ((open[1] - close[1])/2) and close < open[1] and open[trend] > open)
plotshape(data10, title= "Piercing Line", location=location.belowbar, color=lime, style=shape.triangleup)
//, text="Piercing"

lowercandle = lowest(10)[1]
data11=(low == open and  open < lowercandle and open < close and close > ((high[1] - low[1]) / 2) + low[1] and open[trend] > open)
plotshape(data11, title= "Bullish Belt", location=location.belowbar, color=lime, style=shape.triangleup)
//, text="Contenção\nde Alta"

data12=(open[1]>close[1] and open>=open[1] and close>open and open[trend] > open)
plotshape(data12, title= "Bullish Kicker", location=location.belowbar, color=lime, style=shape.triangleup)//, text="Kicker\nde Alta"


data5=(((high - low)>3*(open -close)) and  ((close - low)/(.001 + high - low) > 0.6) and ((open - low)/(.001 + high - low) > 0.6))
plotshape(data5, title= "Hammer", location=location.belowbar, color=white, style=shape.diamond)

data5b=(((high - low)>3*(open -close)) and  ((high - close)/(.001 + high - low) > 0.6) and ((high - open)/(.001 + high - low) > 0.6))
plotshape(data5b, title= "Inverted Hammer", location=location.belowbar, color=white, style=shape.diamond)
//, text="Martelo\nInvertido"

data2=(close[2] > open[2] and min(open[1], close[1]) > close[2] and open < min(open[1], close[1]) and close < open )
//plotshape(data2, title= "Evening Star", location=location.belowbar, color=red, style=shape.arrowdown, text="Estrela\nda Tarde")
plotchar(data2, title="Evening Star", color=white)

data3=(close[2] < open[2] and max(open[1], close[1]) < close[2] and open > max(open[1], close[1]) and close > open )
//plotshape(data3,  title= "Morning Star", location=location.belowbar, color=lime, style=shape.arrowup, text="Estrela\nda Manhã")
plotchar(data3, title="Morning Star", color=white, location=location.belowbar)

data4=(open[1] < close[1] and open > close[1] and high - max(open, close) >= abs(open - close) * 3 and min(close, open) - low <= abs(open - close))
//plotshape(data4, title= "Shooting Star", color=red, style=shape.arrowdown, text="Estrela\nCadente")
plotchar(data4, title="Shooting Star", color=white)



//**********************************************************************************************************



// Ações:

momento = strategy.position_size[0] > strategy.position_size[1]
valorcompra = valuewhen(momento, open, 0)
valorbbw = input(title="Altura Máxima do Bollinger", defval=10)

alerta = crossunder(close, lowerBol)
alertcondition(alerta, title='Abaixo da Banda Baixa', message='Fechou abaixo da banda baixa...!')

//data7 data9 data10 data11 data12

compra =  crossover(close, lowerBol) and ((k<=20) and (d<=20)) and (mexp>mexp[1])
//compra = (data7 or data9 or data10 or data11 or data12) and (msimples>msimples[1]) and ((k<=20) and (d<=20)) and (bbw<valorbbw/1000)
//compra =  (open<close) and (crossover (close, lowerBol)) and ((k<=20) and (d<=20)) and (bbw<valorbbw/1000) and (msimples>msimples[1])

venda = crossover(close, upperBol)
//(close >= (valorcompra + (valorcompra * 0.025))) 

strategy.entry ("Compra", strategy.long, when=compra)
strategy.entry ("Venda", strategy.short, when=venda)


//plotshape(series=compra, title="Compra", style=shape.triangleup, location=location.belowbar, color=green, text="COMPRA", size=size.small)
//plotshape(series=venda, title="Venda", style=shape.triangledown, location=location.abovebar, color=red, text="VENDA", size=size.small)