chiến lược giao dịch đột phá động lực

Tác giả:ChaoZhang, Ngày: 2023-11-28 10:33:31
Tags:

img

Bài viết này giới thiệu một chiến lược giao dịch đột phá động lực dựa trên các mô hình nến. Chiến lược xác định xu hướng thị trường và cơ hội nhập cảnh bằng cách nhận ra các hình thành nến.

Tổng quan chiến lược

Chiến lược đột phá động lực chủ yếu đánh giá các tín hiệu đảo ngược tiềm năng bằng cách xác định các mô hình hấp thụ tăng hoặc mô hình hấp thụ giảm để vào thị trường. Sau khi xác định tín hiệu, nó nhanh chóng theo dõi xu hướng để đạt được lợi nhuận dư thừa.

Nguyên tắc chiến lược

Lý thuyết cốt lõi của chiến lược phá vỡ động lực dựa trên việc xác định các mô hình ngập, bao gồm cả ngập tăng và ngập giảm.

Một mô hình hấp thụ tăng hình thành khi giá đóng của giai đoạn hiện tại cao hơn giá mở, và giá đóng của giai đoạn trước thấp hơn giá mở của giai đoạn trước. Mô hình này thường báo hiệu một sự đảo ngược tâm lý thị trường từ giảm lên tăng, làm cho nó trở thành một cơ hội tốt để theo đuổi xu hướng tăng.

Một mô hình ngập giảm hình thành khi giá đóng của giai đoạn hiện tại thấp hơn giá mở và giá đóng của giai đoạn trước cao hơn giá mở của giai đoạn trước.

Sau khi xác định một mô hình ngập, chiến lược đột phá đà nhanh chóng thiết lập một vị trí với đòn bẩy dư thừa để theo dõi xu hướng đảo ngược tiềm năng. Nó cũng điều chỉnh động mức dừng lỗ và lấy lợi nhuận để kiểm soát rủi ro trong khi khóa lợi nhuận.

Ưu điểm

  1. Chọn nhanh các cơ hội đảo ngược thị trường
  2. Tỷ lệ rủi ro-lợi nhuận cân bằng với mức dừng lỗ và thu lợi nhuận thích hợp
  3. Đặt mục tiêu cho các khoản đầu tư khác nhau
  4. Hiệu quả cao với giao dịch tự động

Rủi ro

  1. Mô hình ngập không đảm bảo hoàn toàn đảo ngược
  2. Khả năng phá vỡ thất bại và hành động giá bên cạnh
  3. Rủi ro thanh lý do đòn bẩy quá mức
  4. Yêu cầu vốn đủ để hỗ trợ định hình đúng quy mô vị thế

Cải tiến

Chiến lược có thể được tối ưu hóa theo những cách sau:

  1. Kết hợp các chỉ số khác để lọc tín hiệu
  2. Điều chỉnh đòn bẩy để hạn chế rủi ro
  3. Tăng quy mô theo cơ sở chi phí thấp hơn
  4. Tối ưu hóa dừng lỗ và lấy lợi nhuận để khóa lợi nhuận

Tóm lại

Chiến lược phá vỡ đà là một chiến lược đảo ngược trung bình điển hình. Bằng cách nắm bắt các tín hiệu nến chính, nó nhanh chóng đánh giá và theo dõi sự đảo ngược xu hướng thị trường. Mặc dù rủi ro tồn tại, chiến lược có thể được tăng cường hiệu quả thông qua nhiều kỹ thuật tối ưu hóa để kiểm soát tỷ lệ rủi ro-lợi nhuận. Nó phù hợp với các nhà đầu tư tích cực tìm kiếm lợi nhuận tương tự như trọng tài.


/*backtest
start: 2022-11-27 00:00:00
end: 2023-11-09 05:20:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy(title = "MomGulfing", shorttitle = "MomGulfing", overlay = true, initial_capital=10000, pyramiding=3, calc_on_order_fills=false, calc_on_every_tick=false, currency="USD", default_qty_type=strategy.cash, default_qty_value=1000, commission_type=strategy.commission.percent, commission_value=0.04)

syear = input(2021)
smonth = input(1)
sday = input(1)
fyear = input(2022)
fmonth = input(12)
fday = input(31)
start = timestamp(syear, smonth, sday, 01, 00)
finish = timestamp(fyear, fmonth, fday, 23, 59)
date = time >= start and time <= finish ? true : false

longs = input(true)
shorts = input(true)
rr = input(2.5)
position_risk_percent = input(1)/100
signal_bar_check = input.string(defval="3", options=["1", "2", "3"])
margin_req = input(80)
sl_increase_factor = input(0.2)
tp_decrease_factor = input(0.0)
check_for_volume = input(true)
var long_sl = 0.0
var long_tp = 0.0
var short_sl = 0.0
var short_tp = 0.0
var long_lev = 0.0
var short_lev = 0.0

initial_capital = strategy.equity
position_risk = initial_capital * position_risk_percent

bullishEngulfing_st = close[1] < open[1] and close > open and high[1] < close and (check_for_volume ? volume[1]<volume : true)
bullishEngulfing_nd = close[2] < open[2] and close[1] > open[1] and close > open and high[2] > close[1] and high[2] < close and (check_for_volume ? volume[2]<volume : true)
bullishEngulfing_rd = close[3] < open[3] and close[2] > open[2] and close[1] > open[1] and close > open and high[3] > close[2] and high[3] > close[1] and high[3] < close and (check_for_volume ? volume[3]<volume : true)
bullishEngulfing = signal_bar_check == "1" ? bullishEngulfing_st : signal_bar_check == "2" ? bullishEngulfing_st or bullishEngulfing_nd : bullishEngulfing_st or bullishEngulfing_nd or bullishEngulfing_rd
long_stop_level = bullishEngulfing_st ? math.min(low[1], low) : bullishEngulfing_nd ? math.min(low[2], low[1], low) : bullishEngulfing_rd ? math.min(low[3], low[2], low[1], low) : na
rr_amount_long = close-long_stop_level
long_exit_level = close + rr*rr_amount_long
long_leverage = math.floor(margin_req/math.floor((rr_amount_long/close)*100))

bearishEngulfing_st = close[1] > open[1] and close < open and low[1] > close and (check_for_volume ? volume[1]<volume : true)
bearishEngulfing_nd = close[2] > open[2] and close[1] < open[1] and close < open and low[2] < close[1] and low[2] > close and (check_for_volume ? volume[2]<volume : true)
bearishEngulfing_rd = close[3] > open[3] and close[2] < open[2] and close[1] < open[1] and close < open and low[3] < close[2] and low[3] < close[1] and low[3] > close and (check_for_volume ? volume[3]<volume : true)
bearishEngulfing = signal_bar_check == "1" ? bearishEngulfing_st : signal_bar_check == "2" ? bearishEngulfing_st or bearishEngulfing_nd : bearishEngulfing_st or bearishEngulfing_nd or bearishEngulfing_rd
short_stop_level = bearishEngulfing_st ? math.max(high[1], high) : bearishEngulfing_nd ? math.max(high[2], high[1], high) : bearishEngulfing_rd ? math.max(high[3], high[2], high[1], high) : na
rr_amount_short = short_stop_level-close
short_exit_level = close - rr*rr_amount_short
short_leverage = math.floor(margin_req/math.floor((rr_amount_short/short_stop_level)*100))

long = longs and date and bullishEngulfing
short = shorts and date and bearishEngulfing
bgcolor(long[1] ? color.new(color.teal, 80) : (short[1] ? color.new(color.purple, 80) : na))

if long and strategy.position_size <= 0
    long_lev := long_leverage

if short and strategy.position_size >= 0
    short_lev := short_leverage

long_pos_size = long_lev * position_risk
long_pos_qty = long_pos_size/close
short_pos_size = short_lev * position_risk
short_pos_qty = short_pos_size/close

if long
    if strategy.position_size <= 0
        long_sl := long_stop_level
        long_tp := long_exit_level

    else if strategy.position_size > 0
        long_sl := long_stop_level + sl_increase_factor*rr_amount_long
        long_tp := long_exit_level - tp_decrease_factor*rr_amount_long

    strategy.entry("L"+str.tostring(long_lev)+"X", strategy.long, qty=long_pos_qty)
    label_text = str.tostring(long_lev)+"X\nSL:"+str.tostring(long_sl)+"\nTP:"+str.tostring(long_tp)
    label.new(bar_index+1, na, text=label_text, color=color.green, style=label.style_label_up, xloc=xloc.bar_index, yloc=yloc.belowbar)

else if short
    if strategy.position_size >= 0
        short_sl := short_stop_level
        short_tp := short_exit_level

    else if strategy.position_size < 0
        short_sl := short_stop_level - sl_increase_factor*rr_amount_short
        short_tp := short_exit_level + tp_decrease_factor*rr_amount_short

    strategy.entry("S"+str.tostring(short_lev)+"X", strategy.short, qty=short_pos_qty)
    label_text = str.tostring(short_lev)+"X\nSL:"+str.tostring(short_sl)+"\nTP:"+str.tostring(short_tp)
    label.new(bar_index+1, na, text=label_text, color=color.red, style=label.style_label_down, xloc=xloc.bar_index, yloc=yloc.abovebar)

if (strategy.position_size > 0)
    strategy.exit(id="L TP/SL", stop=long_sl, limit=long_tp)

if (strategy.position_size < 0)
    strategy.exit(id="S TP/SL", stop=short_sl, limit=short_tp)

sl_level = strategy.position_size > 0 ? long_sl : strategy.position_size < 0 ? short_sl : na
plot(sl_level, color=color.red, style=plot.style_linebr)

tp_level = strategy.position_size > 0 ? long_tp : strategy.position_size < 0 ? short_tp : na
plot(tp_level, color=color.green, style=plot.style_linebr)


Thêm nữa