双时段开盘区间突破追踪止损量化交易策略是一种基于伦敦和纽约交易时段开盘前15分钟价格区间的突破交易系统。该策略通过捕捉这两个主要金融中心开盘初期的价格动量,在价格突破首15分钟形成的高点或低点时进入相应方向的交易。策略的核心特点是采用追踪止损机制,在保护盈利的同时,能够让利润持续增长。该策略同时提供了可选的均线过滤条件,以提高交易质量。
该策略的运行机制围绕两个关键时间段展开:伦敦市场开盘(纽约时间3:00-3:15)和纽约市场开盘(纽约时间9:30-9:45)。策略工作流程如下:
策略的关键逻辑在于捕捉交易时段初期的价格方向性突破,这通常预示着后续可能出现的趋势性行情。通过使用追踪止损机制,策略能够在保护已有利润的同时,让盈利交易继续运行。
经过深入分析,该策略具有以下优势:
尽管该策略设计合理,但仍存在以下潜在风险:
基于策略分析,以下是可能的优化方向:
双时段开盘区间突破追踪止损量化交易策略是一种针对伦敦和纽约两大金融中心开盘时段设计的突破交易系统。通过捕捉开盘初期的价格动量和方向,结合追踪止损机制,该策略能够在控制风险的同时,最大化盈利潜力。虽然存在假突破和市场环境依赖等风险,但通过合理的参数设置和额外的过滤条件,策略的稳定性和盈利能力可以得到进一步提升。该策略特别适合波动性较大且流动性充足的市场,交易者在使用时应根据自身风险承受能力和交易目标进行适当调整。
/*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)