
Chiến lược này là một chiến lược theo dõi xu hướng được cải tiến dựa trên chỉ số Brin Belt. Nó xác nhận sự tin cậy của xu hướng bằng cách giám sát giá với Brin Belt ba lần liên tiếp, do đó giao dịch với tỷ lệ thắng cao hơn. Chiến lược sử dụng đường trung bình di chuyển 20 chu kỳ làm đường trung tâm và tính toán cơ sở cho đường đi lên xuống với chênh lệch tiêu chuẩn gấp 2 lần.
Lập luận cốt lõi của chiến lược này là nhận diện giá tiếp xúc liên tục với biên giới của vùng Brin thông qua cơ chế tính toán. Khi giá phá vỡ đường mòn ba lần liên tiếp, hệ thống sẽ phát ra nhiều tín hiệu; Khi giá phá vỡ đường mòn ba lần liên tiếp, hệ thống sẽ phát ra tín hiệu trống.
Chiến lược này thực hiện một chiến lược theo dõi xu hướng có độ tin cậy cao hơn bằng cách cải tiến hệ thống giao dịch Bollinger Bands truyền thống. Cơ chế xác nhận ba lần chạm của nó có hiệu quả trong việc tăng tỷ lệ giao dịch, trong khi cơ chế đặt cược bằng phẳng dựa trên đường trung bình di chuyển cung cấp một giải pháp kết thúc có lợi nhuận hợp lý. Mặc dù chiến lược vẫn có một số rủi ro vốn có, nhưng bằng cách cung cấp hướng tối ưu hóa, bạn có thể nâng cao hơn nữa sự ổn định và khả năng lợi nhuận của chiến lược.
/*backtest
start: 2024-11-10 00:00:00
end: 2024-12-09 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("Bollinger Bands Strategy - 3 Crossings", overlay=true)
// Input Parameters
length = input.int(20, title="Bollinger Bands Length", minval=1)
src = input(close, title="Source")
mult = input.float(2.0, title="Multiplier", step=0.1)
// Calculate Bollinger Bands
basis = ta.sma(src, length)
dev = mult * ta.stdev(src, length)
upper = basis + dev
lower = basis - dev
// Plot Bollinger Bands
plotBasis = plot(basis, color=color.blue, title="Basis")
plotUpper = plot(upper, color=color.red, title="Upper Band")
plotLower = plot(lower, color=color.green, title="Lower Band")
fill(plot1=plotUpper, plot2=plotLower, color=color.new(color.blue, 90), title="Band Fill")
// Counter Variables
var int longCrossCount = 0
var int shortCrossCount = 0
// Detect Crossings
longCondition = close < lower // Price closes below the lower band
shortCondition = close > upper // Price closes above the upper band
if longCondition
longCrossCount += 1 // Increment the counter for long
shortCrossCount := 0 // Reset the short counter
if shortCondition
shortCrossCount += 1 // Increment the counter for short
longCrossCount := 0 // Reset the long counter
if not longCondition and not shortCondition
longCrossCount := 0 // Reset if no crossing
shortCrossCount := 0
// Entry and Exit Rules
if longCrossCount >= 3 and strategy.position_size <= 0
strategy.entry("Long", strategy.long)
longCrossCount := 0 // Reset the counter after entering
if shortCrossCount >= 3 and strategy.position_size >= 0
strategy.entry("Short", strategy.short)
shortCrossCount := 0 // Reset the counter after entering
// Exit Condition (When Price Returns to the Middle Band)
exitCondition = ta.crossover(src, basis) or ta.crossunder(src, basis)
if exitCondition and strategy.position_size > 0
strategy.close("Long")
if exitCondition and strategy.position_size < 0
strategy.close("Short")