Chiến lược này sử dụng chỉ số đường Brin để xác định mức độ dao động của giá, kết hợp với hình dạng đường K để thực hiện hoạt động phá vỡ giá. Đường trục đường Brin có thể xác định xu hướng tăng và giảm của giá, kết hợp với chỉ số đường K, có thể tìm ra thời điểm mua và bán rõ ràng hơn. Chiến lược này chủ yếu xác định đường Brin phá vỡ đường dưới nhiều hơn, đường trên phá vỡ trống, đồng thời kết hợp với chỉ số Stoch để xác định tình trạng mua quá mức, sử dụng hình dạng đường K để cung cấp tín hiệu mua bán thay thế.
Chiến lược này bao gồm một số chỉ số:
Chỉ số đường Brinh, bao gồm đường giữa đường Brinh, đường trên đường Brinh, đường dưới đường Brinh. Đường Brinh tính toán phạm vi biến động của giá thông qua chênh lệch tiêu chuẩn của giá, từ đó xác định xu hướng biến động của giá.
Chỉ số Stoch, để xác định xem cổ phiếu có đang trong tình trạng quá mua quá bán không. Các đường K và D có thể xác định xem có phá vỡ lên và phá vỡ xuống không.
Hình dạng K, đánh giá một số hình dạng phổ biến như Dòng dương, Dòng âm như là thời gian mua và bán tùy chọn.
Điều kiện mua: Giá vượt qua đường viền dưới đường viền của Brin, chỉ số Stoch cho thấy quá bán ((K <20, D <20), đường trung bình di chuyển nhanh vượt qua đường trung bình di chuyển chậm.
Điều kiện bán: Bắt đầu bán với giá thấp hoặc dừng lỗ sau khi kiếm được lợi nhuận.
Chiến lược này kết hợp phân tích xu hướng và phán đoán mua quá mức, làm giảm tỷ lệ thắng becausefalse, có thể vào thị trường kịp thời khi xu hướng xuất hiện. Tuy nhiên, cũng có nguy cơ bị mắc kẹt và cần dừng lỗ kịp thời.
Kết hợp với đường Brin và chỉ số Stoch, bạn có thể mua khi giá cổ phiếu giảm rõ rệt, giảm rủi ro.
Hình dạng K là điều kiện phụ trợ để tránh mua nhầm trong tình huống chấn động.
Việc sử dụng hai điều kiện đánh giá đã làm tăng sự ổn định và độ tin cậy của chiến lược.
Các cơ chế ngăn chặn thiệt hại có thể tránh được những tổn thất lớn.
Trong giao dịch trực tuyến, dễ bị lừa. Nếu thị trường bị phân chia, có thể gây ra tổn thất lớn.
Chỉ số Stoch có khả năng phát ra tín hiệu sai và có nguy cơ thua lỗ cao khi sử dụng Stoch một mình.
Trong tình huống chấn động, các tín hiệu giao dịch có thể bị nhầm lẫn.
Cần có thời gian để dừng lỗ và kiểm soát rủi ro
Cần chú ý đến độ mạnh của đợt phá vỡ để ngăn chặn cú sốc trở lại.
Tối ưu hóa bể cổ phiếu, chọn cổ phiếu có xu hướng và biến động lớn.
Tối ưu hóa tham số burin, điều chỉnh chu kỳ trung đạo, tối ưu hóa nắm bắt điểm mua và bán.
Tối ưu hóa tham số Stoch, điều chỉnh chu kỳ đường K và đường D, tăng độ tin cậy của chỉ số.
Các nhà phân tích cho rằng, việc tăng giá trị giao dịch là một trong những yếu tố giúp giảm bớt sự sụt giảm của thị trường.
Tăng các chiến lược dừng lỗ, như theo dõi dừng lỗ, di chuyển dừng lỗ, v.v., để kiểm soát rủi ro mất mát.
Đánh giá thêm các chỉ số kỹ thuật khác, như MACD, KDJ, v.v., để tăng sự ổn định của chiến lược.
Kiểm tra thời gian giữ vị trí khác nhau, tối ưu hóa tỷ lệ rút lợi nhuận.
Chiến lược này tích hợp các chỉ số Brinline, Stoch và các chỉ số kỹ thuật cơ bản, với giả định kiểm soát rủi ro, mua ở mức giá thấp và bán gần mức cao lịch sử, để đạt được mô hình lợi nhuận tương đối ổn định. Tuy nhiên, cũng có rủi ro như hiệu quả che đậy, dừng lỗ. Bằng cách tối ưu hóa các tham số và thêm các chỉ số phán đoán khác, bạn có thể tăng thêm sự ổn định và khả năng lợi nhuận liên tục của chiến lược.
/*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)