Sumber dimuat naik... memuat...

Harga Penembusan Bollinger Band A Strategi

Penulis:ChaoZhang, Tarikh: 2023-11-06 11:43:14
Tag:

img

Ringkasan

Strategi ini menggunakan penunjuk Bollinger Band untuk menilai amplitudo turun naik harga, digabungkan dengan corak K-line untuk operasi terobosan harga. Rel atas dan bawah Bollinger Band boleh kira-kira menilai trend harga ke atas dan ke bawah. Menggabungkannya dengan penunjuk corak K-line dapat mengetahui masa beli dan jual yang agak jelas. Strategi ini terutamanya menilai terobosan di bawah Bollinger Band untuk pergi panjang, terobosan di atas rel untuk pergi pendek, sementara menggabungkan penunjuk Stoch untuk menilai status overbought dan oversold, dan menggunakan corak K-line untuk menyediakan isyarat beli dan jual alternatif.

Prinsip Strategi

Strategi ini terdiri daripada penunjuk utama berikut:

  1. Penunjuk Bollinger Band, termasuk Bollinger middle rail, upper rail dan lower rail. Bollinger Band mengira julat turun naik harga melalui penyimpangan standard harga, dengan itu menilai trend turun naik harga.

  2. Indikator stok, untuk menilai sama ada stok berada dalam keadaan overbought atau oversold.

  3. corak K-line, menilai beberapa corak biasa seperti garis Yang besar, garis Yin besar dan lain-lain sebagai peluang perdagangan alternatif.

Keadaan beli: Harga melintasi di atas Bollinger lower rail, penunjuk Stoch menunjukkan status oversold (K<20, D<20), purata bergerak pantas melintasi di atas purata bergerak perlahan.

Keadaan jual: Harga melintasi di bawah Bollinger upper rail, atau stop loss apabila menguntungkan.

Strategi ini menggabungkan kedua-dua analisis trend dan penilaian overbought / oversold, yang mengurangkan kadar isyarat palsu, dan membolehkan kemasukan pasaran tepat pada masanya apabila trend muncul.

Analisis Kelebihan

  1. Menggabungkan Bollinger Band dan penunjuk Stoch, ia boleh membeli pada titik rendah yang jelas, mengurangkan risiko.

  2. Corak K-line berfungsi sebagai keadaan tambahan, mengelakkan pembelian yang salah di pasaran terhad.

  3. Mengambil keputusan syarat berganda meningkatkan kestabilan dan kebolehpercayaan strategi.

  4. Mekanisme stop loss mengelakkan kerugian besar.

Analisis Risiko

  1. Perdagangan dengan Bollinger Bands cenderung untuk terperangkap.

  2. Indikator Stoch mempunyai kebarangkalian tinggi untuk mengeluarkan isyarat palsu.

  3. Adalah mudah untuk menjana isyarat perdagangan yang salah di pasaran yang terikat julat.

  4. Perlu menghentikan kerugian tepat pada masanya untuk mengawal risiko.

  5. Perlu memberi perhatian kepada kekuatan terobosan untuk mengelakkan penarikan balik selepas melonjak tinggi.

Arahan pengoptimuman

  1. Mengoptimumkan kumpulan stok, pilih stok dengan turun naik yang besar dan trend yang jelas.

  2. Mengoptimumkan parameter Bollinger, menyesuaikan kitaran rel tengah, mengoptimumkan pemahaman titik beli / jual.

  3. Mengoptimumkan parameter Stoch, menyesuaikan kitaran garis K dan garis D, meningkatkan kebolehpercayaan penunjuk.

  4. Tambah pertimbangan keadaan jumlah dagangan untuk mengelakkan penurunan selepas melonjak tinggi.

  5. Tambah strategi stop loss seperti trailing stop loss, bergerak stop loss dan lain-lain untuk mengawal risiko kerugian.

  6. Menilai penambahan penunjuk teknikal lain seperti MACD, KDJ dll untuk meningkatkan kestabilan strategi.

  7. Uji tempoh penyimpanan yang berbeza untuk mengoptimumkan nisbah keuntungan dan pengeluaran.

Ringkasan

Strategi ini mengintegrasikan Bollinger Band, penunjuk stok dengan penunjuk asas teknikal. Di bawah premis mengawal risiko, ia membeli pada harga terendah dan menjual berhampiran tahap tertinggi dalam sejarah, mewujudkan model keuntungan yang agak stabil. Tetapi ia juga membawa risiko seperti terperangkap, stop loss yang tidak berkesan dan lain-lain.


/*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)  






Lebih lanjut