고주파 동적 오프닝 범위 돌파 거래 전략

ORB RANGE BREAKOUT HFT EST OHLC SL TP
생성 날짜: 2025-02-21 14:02:59 마지막으로 수정됨: 2025-02-21 14:02:59
복사: 2 클릭수: 519
avatar of ianzeng123 ianzeng123
2
집중하다
319
수행원

고주파 동적 오프닝 범위 돌파 거래 전략 고주파 동적 오프닝 범위 돌파 거래 전략

개요

이 전략은 오프닝 간격 브레이크를 기반으로 한 고주파 거래 시스템으로, 거래일 오전 9시 30분에서 9시 45분 사이에 형성되는 가격 간격에 초점을 맞추고 있다. 전략은 가격이 이 15분 간격을 뚫고 있는지 관찰하여 거래 결정을 내리고, 동적 인 중지 및 수익을 설정하여 위험과 수익의 최적의 조화를 달성한다. 시스템은 또한 거래일 필터링 기능을 포함하고 있으며, 다른 시간대의 시장 특성에 따라 선택적으로 거래 할 수 있다.

전략 원칙

전략의 핵심 논리는 매 거래일 개시 후 15분 이내에 ([[9:30-9:45 EST]]) 가격대를 구축하여 그 기간 동안의 최고 가격과 최저 가격을 기록하는 것이다. 한 번 범주가 형성되면, 전략은 그 날 12시까지 가격 돌파구를 감시한다:

  • 가격이 범위를 돌파했을 때, 더 많이 입점하십시오. 상쇄 손실은 범위를 0.5배로 설정하고, 상쇄 손실은 3배로 설정합니다.
  • 가격이 하락하면 포지션이 공백, 중지 및 중지되는 설정 원칙이 동일합니다. 이 전략은 또한 반복 거래를 방지하는 메커니즘을 포함하고 있으며, 하루에 한 번만 거래되는 것을 보장하고 종결 시 모든 지분을 청산합니다.

전략적 이점

  1. 시간 효율성: 이 전략은 상장 후 가장 활발한 거래 시간에 초점을 맞추고, 초기 상장에서의 큰 변동 기회를 잡을 수 있습니다.
  2. 위험 제어: 동적인 스톱 스 설정을 사용하여 실제 변동의 크기에 따라 위험 관리 매개 변수를 결정합니다.
  3. 거래의 유연성: 특정 시장 환경에서 불리한 거래일을 피하기 위해 주간 거래일을 선택할 수 있는 기능
  4. 명확한 실행: 거래 신호가 명확하고, 입출장 조건이 명확하며, 주관적 판단에 영향을 받지 않습니다.
  5. 높은 수준의 자동화: 전체 프로세스를 자동화하여 인간의 개입으로 인한 감정적 인 영향을 줄입니다.

전략적 위험

  1. 가짜 브레이크 위험: 플레이스 칸이 형성된 후의 첫 번째 브레이크가 가짜 브레이크가 될 수 있으며, 이로 인해 종료 손실이 발생할 수 있습니다.
  2. 시간적 쇠퇴: 전략은 오전 시간에만 거래하고 다른 시간대에 좋은 기회를 놓칠 수 있습니다.
  3. 변동성 의존성: 시장의 변동성이 적은 날에는 전략이 충분한 수익을 내기 어려울 수 있습니다.
  4. 슬라이드 포인트 영향: 높은 주파수 거래 전략으로 실행 과정에서 큰 슬라이드 포인트 손실을 겪을 수 있습니다.
  5. 시장 환경 의존성: 전략적 성과는 전체 시장 환경에 의해 크게 영향을 받을 수 있습니다.

전략 최적화 방향

  1. 거래량 지표 도입: 돌파할 때 거래량을 관찰하여 가짜 돌파 신호를 필터링할 수 있다.
  2. 동적으로 거래 시간을 조정: 다양한 품종의 활동 기간 특성에 따라 거래 시간 창을 최적화
  3. 트렌드 필터링을 추가: 더 큰 시간 주기에서의 트렌드 판단과 함께 거래 방향의 정확성을 향상시킵니다.
  4. 최적화 스톱 손실 설정: 스톱 손실 거리를 설정하기 위해 동적인 ATR 지표를 사용할 수 있습니다.
  5. 변동율 필터를 추가: 거래 시작 전에 변동율 수준을 평가하여 당일 거래를 실행할지 여부를 결정합니다

요약하다

이것은 합리적이고, 논리적으로 엄격한 상장 간격 돌파 전략을 설계하여 시장이 가장 활발한 시간에 초점을 맞추어 거래 기회를 잡습니다. 전략의 장점은 명확한 거래 논리와 완벽한 위험 제어 장치에 있습니다. 그러나 동시에 가짜 돌파구 및 시장 환경 의존과 같은 잠재적인 위험에 주의해야합니다. 지속적인 최적화 및 개선으로 이 전략은 실제 거래에서 안정적인 수익을 얻을 수 있습니다.

전략 소스 코드
/*backtest
start: 2025-01-21 00:00:00
end: 2025-01-24 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Binance","currency":"DOGE_USDT"}]
args: [["MaxCacheLen",580,358374]]
*/

// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © UKFLIPS69

//@version=6
strategy("ORB", overlay=true, fill_orders_on_standard_ohlc = true)

trade_on_monday = input(false, "Trade on Monday") 
trade_on_tuesday = input(true, "Trade on Tuesday") 
trade_on_wednesday = input(true, "Trade on Wednesday")
trade_on_thursday = input(false, "Trade on Thursday")
trade_on_friday = input(true, "Trade on Friday")
// Get the current day of the week (1=Monday, ..., 6=Saturday, 0=Sunday)
current_day = dayofweek(time) 
current_price = request.security(syminfo.tickerid, "1", close)
// Define trading condition based on the day of the week
is_trading_day = (trade_on_monday and current_day == dayofweek.monday) or
                 (trade_on_tuesday and current_day == dayofweek.tuesday) or
                 (trade_on_wednesday and current_day == dayofweek.wednesday) or
                 (trade_on_thursday and current_day == dayofweek.thursday) or
                 (trade_on_friday and current_day == dayofweek.friday)
// ─── Persistent variables ─────────────────────────
var line  orHighLine       = na   // reference to the drawn line for the OR high
var line  orLowLine        = na   // reference to the drawn line for the OR low
var float orHigh           = na   // stores the open-range high
var float orLow            = na   // stores the open-range low
var int   barIndex930      = na   // remember the bar_index at 9:30
var bool  rangeEstablished = false
var bool  tradeTakenToday  = false  // track if we've opened a trade for the day

// ─── Detect times ────────────────────────────────
is930  = (hour(time, "America/New_York") == 9 and minute(time, "America/New_York") == 30)
is945  = (hour(time, "America/New_York") == 9 and minute(time, "America/New_York") == 45)

// Between 9:30 and 9:44 (inclusive of 9:30 bar, exclusive of 9:45)?
inSession = (hour(time, "America/New_York") == 9 and minute(time, "America/New_York") >= 30 and minute(time, "America/New_York") < 45)

// ─── Reset each day at 9:30 ─────────────────────
if is930
    // Reset orHigh / orLow
    orHigh := na
    orLow  := na
    rangeEstablished := false
    tradeTakenToday  := false
    // Record the bar_index for 9:30
    barIndex930 := bar_index
// ─── ONLY FORM OR / TRADE IF TODAY IS ALLOWED ─────────────────────
if is_trading_day
// ─── Accumulate the OR high/low from 9:30 to 9:44 ─
    if inSession
        orHigh := na(orHigh) ? high : math.max(orHigh, high)
        orLow  := na(orLow)  ? low  : math.min(orLow, low)

// ─── Exactly at 9:45, draw the lines & lock range ─
    if is945 and not na(orHigh) and not na(orLow)

    // Mark that the OR is established
        rangeEstablished := true

// ─── TRADING LOGIC AFTER 9:45, but BEFORE NOON, and if NO trade taken ─
    if rangeEstablished and not na(orHigh) and not na(orLow) 
    // Only trade if it's still BEFORE 12:00 (noon) EST and we haven't taken a trade today
        if hour(time, "America/New_York") < 12 and (not tradeTakenToday)
        // 1) Compute distances for stops & targets
            float stopSize   = 0.5 * (orHigh - orLow)      // half the OR size
            float targetSize = 3 * stopSize      // 3x the stop => 1.5x the entire OR
    
        // 2) Check if price breaks above OR => go long
            if close > orHigh 
            // Only enter a new long if not already in a long position (optional)
                if strategy.position_size <= 0
                    strategy.entry("ORB Long", strategy.long)
                    strategy.exit("Long Exit", from_entry = "ORB Long", stop = orHigh - stopSize, limit  = strategy.position_avg_price + targetSize)
                // Flag that we've taken a trade today
                    tradeTakenToday := true
    
        // 3) Check if price breaks below OR => go short
            if close < orLow 
            // Only enter a new short if not already in a short position (optional)
                if strategy.position_size >= 0
                    strategy.entry("ORB Short", strategy.short)
                    strategy.exit("Short Exit", from_entry = "ORB Short", stop = orLow + stopSize, limit  = strategy.position_avg_price - targetSize)
                // Flag that we've taken a trade today
                    tradeTakenToday := true
if hour(time, "America/New_York") == 16 and minute(time, "America/New_York") == 0
    strategy.close_all()