
Chiến lược giao dịch định lượng theo dõi phá vỡ lỗ hổng trong khoảng thời gian mở cửa là một hệ thống giao dịch phá vỡ dựa trên khoảng thời gian giá 15 phút trước khi mở cửa trong giờ giao dịch London và New York. Chiến lược này bằng cách nắm bắt động lực giá trong thời gian mở cửa của hai trung tâm tài chính chính, vào giao dịch theo hướng tương ứng khi giá phá vỡ 15 phút đầu tiên.
Cơ chế hoạt động của chiến lược xoay quanh hai khoảng thời gian quan trọng: thị trường mở cửa ở Luân Đôn (thời gian New York 3: 00-3: 15) và thị trường mở cửa ở New York (thời gian New York 9: 30-9: 45).
Lý luận quan trọng của chiến lược là nắm bắt đợt phá vỡ định hướng giá trong giai đoạn đầu của giao dịch, thường là dấu hiệu cho thấy có thể xảy ra các hành vi theo xu hướng tiếp theo. Bằng cách sử dụng các cơ chế chặn lỗ theo dõi, chiến lược có thể cho phép giao dịch có lợi nhuận tiếp tục hoạt động trong khi bảo vệ lợi nhuận đã đạt được.
Sau khi phân tích kỹ lưỡng, chiến lược này có những lợi thế sau:
Mặc dù chiến lược này được thiết kế hợp lý, nhưng vẫn có những rủi ro tiềm ẩn:
Dựa trên phân tích chiến lược, các hướng tối ưu hóa có thể là:
Chiến lược giao dịch định lượng theo dõi phá vỡ lỗ hổng giữa hai giai đoạn mở cửa là một hệ thống giao dịch đột phá được thiết kế cho thời gian mở cửa của hai trung tâm tài chính lớn ở London và New York. Bằng cách nắm bắt động thái và hướng của giá trong thời gian mở cửa, kết hợp với cơ chế theo dõi lỗ hổng, chiến lược này có thể tối đa hóa tiềm năng lợi nhuận trong khi kiểm soát rủi ro. Mặc dù có rủi ro như phá vỡ giả và phụ thuộc vào môi trường thị trường, nhưng sự ổn định và khả năng lợi nhuận của chiến lược có thể được nâng cao hơn nữa bằng cách đặt các tham số hợp lý và các điều kiện lọc bổ sung.
/*backtest
start: 2024-04-27 00:00:00
end: 2025-04-25 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"SOL_USDT"}]
*/
//@version=6
strategy("ORB-LD-NY-Trail Strategy", overlay=true,
default_qty_type=strategy.fixed, default_qty_value=1,
calc_on_order_fills=true, calc_on_every_tick=true)
// =========================
// USER INPUTS
// =========================
riskReward = input.float(2.0, "Risk-Reward Ratio", minval=1.0)
minBoxSize = input.float(2.0, "Minimum Box Size (points)")
trailStopTicks = input.int(8, "Trailing Stop (ticks)", minval=1)
useEmaFilter = input.bool(false, "Use 5-min EMA Filter?")
tickSize = syminfo.mintick // auto-detect min tick for symbol
trailStopOffset = trailStopTicks * tickSize
emaSource = request.security(syminfo.tickerid, "5", ta.ema(close, 200)) // 5-min chart EMA
// =========================
// SESSION TIMES
// =========================
londonStart = timestamp("America/New_York", year, month, dayofmonth, 3, 0)
londonEnd = timestamp("America/New_York", year, month, dayofmonth, 3, 15)
nyStart = timestamp("America/New_York", year, month, dayofmonth, 9, 30)
nyEnd = timestamp("America/New_York", year, month, dayofmonth, 9, 45)
inLondon = time >= londonStart and time <= londonEnd
inNY = time >= nyStart and time <= nyEnd
// =========================
// ONE TRADE PER SESSION FLAGS
// =========================
var bool londonTraded = false
var bool nyTraded = false
// =========================
// LONDON BOX
// =========================
var float londonHigh = na
var float londonLow = na
var float londonBoxHigh = na
var float londonBoxLow = na
if inLondon
if na(londonHigh)
londonBoxHigh := na
londonBoxLow := na
londonTraded := false
londonHigh := na(londonHigh) ? high : math.max(londonHigh, high)
londonLow := na(londonLow) ? low : math.min(londonLow, low)
if not inLondon and na(londonBoxHigh) and not na(londonHigh) and not na(londonLow)
londonBoxHigh := londonHigh
londonBoxLow := londonLow
londonHigh := na
londonLow := na
if time > londonEnd and not na(londonBoxHigh) and not londonTraded
boxRange = londonBoxHigh - londonBoxLow
if boxRange >= minBoxSize
// Standard SL/TP logic
longSL = londonBoxHigh - boxRange
longTP = londonBoxHigh + boxRange * riskReward
shortSL = londonBoxLow + boxRange
shortTP = londonBoxLow - boxRange * riskReward
// === LONDON LONG ===
condLong1 = close[1] <= londonBoxHigh
condLong2 = close > londonBoxHigh
condLong3 = (not useEmaFilter) or (close > emaSource)
if condLong1 and condLong2 and condLong3
strategy.entry("London Long", strategy.long)
strategy.exit("Exit London Long", from_entry="London Long",
stop=longSL, limit=longTP,
trail_points=trailStopOffset)
londonTraded := true
// === LONDON SHORT ===
condShort1 = close[1] >= londonBoxLow
condShort2 = close < londonBoxLow
condShort3 = (not useEmaFilter) or (close < emaSource)
if not londonTraded and condShort1 and condShort2 and condShort3
strategy.entry("London Short", strategy.short)
strategy.exit("Exit London Short", from_entry="London Short",
stop=shortSL, limit=shortTP,
trail_points=trailStopOffset)
londonTraded := true
// =========================
// NY BOX
// =========================
var float nyHigh = na
var float nyLow = na
var float nyBoxHigh = na
var float nyBoxLow = na
if inNY
if na(nyHigh)
nyBoxHigh := na
nyBoxLow := na
nyTraded := false
nyHigh := na(nyHigh) ? high : math.max(nyHigh, high)
nyLow := na(nyLow) ? low : math.min(nyLow, low)
if not inNY and na(nyBoxHigh) and not na(nyHigh) and not na(nyLow)
nyBoxHigh := nyHigh
nyBoxLow := nyLow
nyHigh := na
nyLow := na
if time > nyEnd and not na(nyBoxHigh) and not nyTraded
boxRange = nyBoxHigh - nyBoxLow
if boxRange >= minBoxSize
longSL = nyBoxHigh - boxRange
longTP = nyBoxHigh + boxRange * riskReward
shortSL = nyBoxLow + boxRange
shortTP = nyBoxLow - boxRange * riskReward
// === NY LONG ===
condNYLong1 = close[1] <= nyBoxHigh
condNYLong2 = close > nyBoxHigh
condNYLong3 = (not useEmaFilter) or (close > emaSource)
if condNYLong1 and condNYLong2 and condNYLong3
strategy.entry("NY Long", strategy.long)
strategy.exit("Exit NY Long", from_entry="NY Long",
stop=longSL, limit=longTP,
trail_points=trailStopOffset)
nyTraded := true
// === NY SHORT ===
condNYShort1 = close[1] >= nyBoxLow
condNYShort2 = close < nyBoxLow
condNYShort3 = (not useEmaFilter) or (close < emaSource)
if not nyTraded and condNYShort1 and condNYShort2 and condNYShort3
strategy.entry("NY Short", strategy.short)
strategy.exit("Exit NY Short", from_entry="NY Short",
stop=shortSL, limit=shortTP,
trail_points=trailStopOffset)
nyTraded := true
// Visual session background
bgcolor(inLondon ? color.new(color.fuchsia, 85) : na)
bgcolor(inNY ? color.new(color.green, 85) : na)