
Chiến lược giao dịch xu hướng đảo ngược đa yếu tố là một hệ thống giao dịch được lập trình đặc biệt được thiết kế để xác định các điểm đảo ngược tiềm năng sau khi thị trường tăng hoặc giảm liên tục. Chiến lược này sử dụng phân tích biến động giá, kết hợp nhiều chỉ số kỹ thuật như xác nhận lưu lượng giao dịch và dải kênh (dải Brin hoặc kênh Kentner) để nắm bắt cơ hội đảo ngược khi thị trường quá mua hoặc quá bán.
Chiến lược này dựa trên ba yếu tố chính để tạo ra tín hiệu giao dịch:
Các tín hiệu giao dịch cần phải đáp ứng một loạt các điều kiện được thiết lập. Sau khi xác nhận kết thúc K, hệ thống sẽ vẽ dấu hình tam giác ở vị trí phù hợp và thực hiện các hoạt động đa không gian tương ứng. Chiến lược sử dụng 80% lợi nhuận tài khoản làm kích thước vị trí cho mỗi giao dịch và tính đến phí xử lý giao dịch 0,01%
Chiến lược giao dịch đảo ngược xu hướng đa yếu tố cung cấp cho các nhà giao dịch một chương trình giao dịch đảo ngược có hệ thống bằng cách phân tích tổng hợp thông tin thị trường về nhiều chiều như hình dạng giá, thay đổi khối lượng giao dịch và đột phá kênh. Ưu điểm của chiến lược là cấu hình tham số linh hoạt và cơ chế xác nhận tín hiệu đa chiều, nhưng cũng cần chú ý đến điều chỉnh môi trường thị trường và kiểm soát rủi ro.
/*backtest
start: 2024-12-03 00:00:00
end: 2024-12-10 00:00:00
period: 10m
basePeriod: 10m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy(title="The Bar Counter Trend Reversal Strategy [TradeDots]", overlay=true, initial_capital = 10000, default_qty_type = strategy.percent_of_equity, default_qty_value = 80, commission_type = strategy.commission.percent, commission_value = 0.01)
// Initialize variables
var bool rise_triangle_ready = false
var bool fall_triangle_ready = false
var bool rise_triangle_plotted = false
var bool fall_triangle_plotted = false
//Strategy condition setup
noOfRises = input.int(3, "No. of Rises", minval=1, group="STRATEGY")
noOfFalls = input.int(3, "No. of Falls", minval=1, group="STRATEGY")
volume_confirm = input.bool(false, "Volume Confirmation", group="STRATEGY")
channel_confirm = input.bool(true, "", inline="CHANNEL", group="STRATEGY")
channel_type = input.string("KC", "", inline="CHANNEL", options=["BB", "KC"],group="STRATEGY")
channel_source = input(close, "", inline="CHANNEL", group="STRATEGY")
channel_length = input.int(20, "", inline="CHANNEL", minval=1,group="STRATEGY")
channel_mult = input.int(2, "", inline="CHANNEL", minval=1,group="STRATEGY")
//Get channel line information
[_, upper, lower] = if channel_type == "KC"
ta.kc(channel_source, channel_length,channel_mult)
else
ta.bb(channel_source, channel_length,channel_mult)
//Entry Condition Check
if channel_confirm and volume_confirm
rise_triangle_ready := ta.falling(close, noOfFalls) and ta.rising(volume, noOfFalls) and high > upper
fall_triangle_ready := ta.rising(close, noOfRises) and ta.rising(volume, noOfRises) and low < lower
else if channel_confirm
rise_triangle_ready := ta.falling(close, noOfFalls) and low < lower
fall_triangle_ready := ta.rising(close, noOfRises) and high > upper
else if volume_confirm
rise_triangle_ready := ta.falling(close, noOfFalls) and ta.rising(volume, noOfFalls)
fall_triangle_ready := ta.rising(close, noOfRises) and ta.rising(volume, noOfRises)
else
rise_triangle_ready := ta.falling(close, noOfFalls)
fall_triangle_ready := ta.rising(close, noOfRises)
// Check if trend is reversed
if close > close[1]
rise_triangle_plotted := false // Reset triangle plotted flag
if close < close[1]
fall_triangle_plotted := false
//Wait for bar close and enter trades
if barstate.isconfirmed
// Plot triangle when ready and counts exceed threshold
if rise_triangle_ready and not rise_triangle_plotted
label.new(bar_index, low, yloc = yloc.belowbar, style=label.style_triangleup, color=color.new(#9CFF87,10))
strategy.entry("Long", strategy.long)
rise_triangle_plotted := true
rise_triangle_ready := false // Prevent plotting again until reset
if fall_triangle_ready and not fall_triangle_plotted
label.new(bar_index, low, yloc = yloc.abovebar, style=label.style_triangledown, color=color.new(#F9396A,10))
strategy.entry("Short", strategy.short)
fall_triangle_plotted := true
fall_triangle_ready := false
// plot channel bands
plot(upper, color = color.new(#56CBF9, 70), linewidth = 3, title = "Upper Channel Line")
plot(lower, color = color.new(#56CBF9, 70), linewidth = 3, title = "Lower Channel Line")