Chiến lược phá vỡ lá cờ bò

Tác giả:ChaoZhang, Ngày: 2024-02-22 16:41:04
Tags:

img

Tổng quan

Chiến lược phá vỡ cờ bò là một chiến lược phân tích kỹ thuật xác định các mẫu biểu đồ cờ bò và nhập vào điểm phá vỡ, nhằm mục đích nắm bắt sự khởi đầu của một xu hướng.

Chiến lược logic

Các bước chính của chiến lược này là:

  1. Xác định cột cờ: Cần giá cao mới và phá vỡ kênh ATR.
  2. Xác định chiều cao cột: đo khoảng cách giữa đỉnh cột và SMA trước đó.
  3. Xác định phạm vi cờ: đáy cờ là 33% chiều cao cột như phạm vi tối thiểu.
  4. Xác định mô hình cờ: phán xét nếu 3 thanh cuối cùng đều trong phạm vi cờ.
  5. Nhập: Đi dài khi biểu mẫu cờ xuất hiện.
  6. Đi ra: Khép vị trí sau khi cố định 6 thanh.

Khi đánh giá cờ và lá cờ, chiến lược sử dụng thông minh chỉ số ATR để xác định các đột phá đáng kể và hạn chế nghiêm ngặt chiều cao cờ trong phạm vi 33% chiều cao của cây cột để tránh tín hiệu sai quá mức. Ngoài ra, yêu cầu 3 thanh liên tiếp để tạo ra cờ cải thiện độ tin cậy. Nhìn chung, các quy tắc chiến lược được thiết kế nghiêm ngặt và có một số lợi thế trong việc nắm bắt các đột phá xu hướng sớm.

Phân tích lợi thế

Những lợi thế chính của chiến lược này bao gồm:

  1. Sử dụng các mẫu cờ để xác định xu hướng bắt đầu là một phương pháp phân tích kỹ thuật cổ điển với tỷ lệ thành công cao.
  2. ATR và giới hạn phạm vi nghiêm ngặt tránh nhiều tín hiệu sai và cải thiện độ chính xác nhập cảnh.
  3. Cài đặt khóa thoát 6 bar trong một số lợi nhuận và tránh rủi ro đảo ngược.
  4. Quy tắc rõ ràng dễ thực hiện, hiểu và tuân theo.
  5. Có thể tìm thấy cơ hội trong các điều kiện thị trường khác nhau, linh hoạt.

Phân tích rủi ro

Những rủi ro chính của chiến lược này là:

  1. Các lá cờ không thể xác định hoàn toàn xu hướng, những thất bại vẫn tồn tại.
  2. 6 bar có thể là quá sớm và quá sớm.
  3. Thị trường hỗn loạn có thể dễ dàng tạo ra cờ giả.
  4. Không thể kiểm soát hiệu quả số tiền mất mát đơn.

Để giải quyết các rủi ro trên, chúng ta có thể thiết lập dừng lỗ, tối ưu hóa các cơ chế thoát để khóa lợi nhuận khi đạt đến tỷ lệ lợi nhuận nhất định.

Hướng dẫn tối ưu hóa

Một số hướng để tối ưu hóa chiến lược:

  1. Kết hợp các chỉ số như MACD, KD để tránh tín hiệu sai trong thị trường hỗn loạn.
  2. Đặt tham số của ATR nhân, thời gian thoát dựa trên chế độ thị trường để cải thiện khả năng thích nghi.
  3. Đặt stop loss sau hoặc xem xét tỷ lệ thu lợi nhuận cho các bước ra động.
  4. Hãy thử các phương pháp học máy để tìm các tính năng tốt hơn để xác định chiều cao lá cờ.
  5. Đánh giá tỷ lệ chiến thắng thực tế và tỷ lệ lợi nhuận, điều chỉnh kích thước vị trí một cách năng động.

Kết luận

Kết luận, chiến lược đột phá cờ bò sử dụng mô hình kỹ thuật để xác định sự khởi đầu của xu hướng, một phương pháp khá cổ điển, và các quy tắc nhập thực sự được thiết kế nghiêm ngặt để lọc ra nhiều tín hiệu sai. Nhưng có chỗ để cải thiện kiểm soát rủi ro và thoát toàn diện để chiến lược có thể hoạt động ổn định trên các thị trường khác nhau sau khi xác minh và tối ưu hóa đầy đủ. Nó có thể trở thành một thành phần có giá trị trong một hệ thống giao dịch định lượng.


/*backtest
start: 2024-01-22 00:00:00
end: 2024-02-21 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// © smith26
//This strategy enters on a bull flag and closes position 6 bars later.  Average true range is used instead of a moving average.
//The reason for ATR instead of MA is because with volatile securities, the flagpole must stand up a noticable "distance" above the trading range---which you can't determine with a MA alone.
//This is broken up into multiple parts: Defining a flagpole, defining the pole height, and defining the flag, which will be constrained to the top third (33%) of the pole height to be considered a flag.
//@version=4
strategy("Bull Flag v1.00", overlay=true)

ATR = atr(10) //Average True Range over last 10 bars.

upperATR = ohlc4[1] + ATR[1]  //Open + High + Low + Close divided by 4, + prior ATR.  Just used here for visually plotting the ATR upper channel.
lowerATR = ohlc4[1] - ATR[1] //Open + High + Low + Close divided by 4, - prior ATR.  Just used here for visually plotting the ATR lower channel.

//uncomment these two lines to see ATR channels
plot(upperATR, color=color.orange)
plot (lowerATR, color=color.orange)

//Current close higher than previous close, and current close minus current open is greater than 3 times the previous ATR.  "3x ATR" is chosen because any less was not a noticeable distance above the trading range.
flagpole1 = close>close[1] and (close-open) > (ATR[1] * 3)
plotshape(flagpole1, text="flagpole1", style=shape.arrowdown, size=size.huge) //Plots an arrow for flagpole1 for QA testing

//Two consecutive close higer than their previous close, and current close minus PREVIOUS open is greater than 3 times the previous ATR.
flagpole2 = close>close[1] and close[1]>close[2] and (close-open[1]) > (ATR[1] * 3)
plotshape(flagpole2, text="flagpole2", style=shape.arrowdown, size=size.huge, color=color.yellow) //Plots an arrow for flagpole2 for QA testing

//Three consecutive close higer than their previous close, and current close minus open from 2 bars ago is greater than 3 times the previous ATR.
flagpole3 = close>close[1] and close[1]>close[2] and close[2]>close[3] and (close-open[2]) > (ATR[1] * 3)
plotshape(flagpole3, text="flagpole3", style=shape.arrowdown, size=size.huge, color=color.white) //Plots an arrow for flagpole3 for QA testing

//A flagpole can be any of the three definitions of flagpole.
flagpole = flagpole1 or flagpole2 or flagpole3

//This will return the number of bars since "flagpole" was true.  Not being used, but could be useful.
//since_flagpole = barssince(flagpole)

after_pole_1 = flagpole[1] //This marks the bar directly after a flagpole.  
//plotshape(after_pole_1, text="after_pole_1", style=shape.cross, size=size.large, color=color.white) //Plots a cross for after_pole_1 for QA testing
after_pole_2 = flagpole[2] //This marks the bar two bars after a flagpole.  
after_pole_3 = flagpole[3] //This marks the bar three bars after a flagpole.  

//This returns the price at the "top" of the flagpole (using close price) at the most recent occurence, 0.
pole_top = valuewhen(flagpole, close, 0)
//plot(pole_top, trackprice=true)  //plots a horizontal line at the most recent pole_top

//Measures the distance between last pole top and the previous SMA.
pole_height = pole_top - sma(close, 10)[1] 
//plot(pole_height)

//This marks 33% below the pole_top, which will be the lowest point a flag can be.
flag_bottom = pole_top - (.33 * pole_height)
//plot(flag_bottom)

//The first, second, and third bars after the pole are considered part of a flag when open and close are between the pole_top and flag_bottom
flag1 = after_pole_1 and (open >= flag_bottom) and (open <= pole_top) and (close >= flag_bottom) and (close <= pole_top)
//plotshape(flag1, text="flag1", style=shape.flag, size=size.large, color=color.teal)
flag2 = after_pole_2 and (open >= flag_bottom) and (open <= pole_top) and (close >= flag_bottom) and (close <= pole_top)
//plotshape(flag2, text="flag2", style=shape.flag, size=size.large, color=color.teal)
flag3 = after_pole_3 and (open >= flag_bottom) and (open <= pole_top) and (close >= flag_bottom) and (close <= pole_top)
//plotshape(flag3, text="flag3", style=shape.flag, size=size.large, color=color.teal)

//When all three bars after a flagpole are a flag, the criteria are met and we have a "bull_flag"
//Specifically, when current bar is flag3, previous bar is flag2, and 2 bars ago is flag1, we have a bull_flag.
bull_flag = flag3 and flag2[1] and flag1[2]
plotshape(bull_flag, text="bull_flag", style=shape.flag, size=size.large, color=color.white) //Plots a flag for bull_flag for QA testing


if (bull_flag)
    strategy.entry("Long", strategy.long)

if barssince(bull_flag) == 6 //close 6 bars after entry.
    strategy.close("Long")

Thêm nữa