고급 기회 공간 오실레이터 전략: 공정 가치 갭을 기반으로 한 양적 거래 시스템

FVG ATR SMA VOL BFVG SFVG
생성 날짜: 2025-02-21 10:43:26 마지막으로 수정됨: 2025-02-24 14:55:25
복사: 1 클릭수: 362
avatar of ianzeng123 ianzeng123
2
집중하다
319
수행원

고급 기회 공간 오실레이터 전략: 공정 가치 갭을 기반으로 한 양적 거래 시스템 고급 기회 공간 오실레이터 전략: 공정 가치 갭을 기반으로 한 양적 거래 시스템

개요

이 전략은 공정 가치 격차 (FVG) 를 기반으로 한 혁신적인 거래 시스템으로, 시장의 가격 격차와 거래량 비정상성을 식별하여 잠재적인 거래 기회를 포착합니다. 이 전략은 동적 계산 메커니즘과 통일 처리 방식을 결합하여 구매 신호를 정확하게 식별 할 수있을뿐만 아니라 거래자가 시장 구조를 더 잘 이해할 수 있도록 시각적으로 표시 할 수 있습니다.

전략 원칙

전략의 핵심은 연속적인 K 라인 사이의 가격 격차를 모니터링하여 잠재적인 거래 기회를 식별하는 것입니다. 구체적으로:

  1. 다목적 FVG ((BFVG) 형성 조건은 현재 K선의 최저가격이 두 K선 전의 최고가격보다 높다는 것이다.
  2. 공백 FVG ((SFVG) 형성 조건은 현재 K선의 최고 가격이 두 K선 전의 최저 가격보다 낮다
  3. 이 전략은 거래량과 틈새 크기에 기반한 검증 메커니즘을 도입했으며, 검증 조건을 만족하는 FVG만이 거래 신호를 유발한다.
  4. 50 회의 동적 카운트 창을 사용하여 공중 FVG 수를 축적합니다.
  5. 격자 너비를 더 직관적인 지표값으로 변환하여 일원화 처리

전략적 이점

  1. 시스템에는 완벽한 신호 검증 메커니즘이 있으며, 거래량과 틈새 폭의 이중 확인을 통해 신호 품질을 향상시킵니다.
  2. 동적 카운터 창은 시장 추세의 변화를 효과적으로 포착합니다.
  3. 통일화 처리는 서로 다른 시대의 신호를 비교할 수 있게 한다.
  4. 전략은 자동 포지션 관리 기능이 있으며, 새로운 포지션을 개설하기 전에 자동으로 반전 포지션을 평행합니다.
  5. 시장 상황을 이해하기 위한 훌륭한 시각화 효과

전략적 위험

  1. FVG 신호는 높은 변동성 시장에서 가짜 신호를 생성할 수 있다.
  2. 고정된 검증 매개 변수는 모든 시장 환경에 적용되지 않을 수 있습니다.
  3. 손해 방지 및 차단 장치가 설정되지 않아 더 큰 회수로 이어질 수 있습니다.
  4. 자주 거래하면 거래 비용이 더 많이 들 수 있습니다. 이러한 위험을 관리하기 위해 적절한 스톱 포지션을 설정하고 시장 환경 필터를 도입하는 것이 좋습니다.

전략 최적화 방향

  1. 다양한 시장 환경에 더 잘 적응할 수 있도록 자율적인 변수 조정 메커니즘을 도입
  2. 트렌드 필터를 추가하여 강한 트렌드에서 단방향 거래만 합니다.
  3. 더 복잡한 창고 관리 시스템을 설계, 수량 창고 및 동적 상쇄를 포함
  4. 거래 비용에 대한 고려, 거래 빈도 최적화
  5. 다른 기술 지표와 결합하여 신호의 신뢰성을 향상시킵니다.

요약하다

이것은 가격 구조에 기반한 혁신적인 거래 전략이며, 공정 가치의 허점을 지능적으로 식별하고 검증하여 시장 기회를 포착합니다. 전략의 설계 개념은 명확하고, 실행 방식은 전문적이며, 확장성이 좋습니다. 제안된 최적화 방향으로 전략의 안정성과 수익성은 더욱 향상될 것으로 예상됩니다.

전략 소스 코드
/*backtest
start: 2024-02-22 00:00:00
end: 2025-02-19 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/

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

//@version=5
strategy("FVG Oscillator Strategy", 
     shorttitle="FVG Osc v5 [Strategy]", 
     overlay=false, 
     initial_capital=100000, 
     default_qty_type=strategy.percent_of_equity, 
     default_qty_value=100)

//------------------------------------------------------------------------------
// 1) Input Parameters
//------------------------------------------------------------------------------
lnt   = input.int(50, "Bars Back")
area  = input.bool(true, "Show Areas")
upcol = input.color(#2962ff, "Positive Color")
dncol = input.color(#e91e63, "Negative Color")

//------------------------------------------------------------------------------
// 2) FVG Detection
//    bfvg = bullish FVG, sfvg = bearish FVG
//------------------------------------------------------------------------------
bfvg = low > high[2]
sfvg = high < low[2]

//------------------------------------------------------------------------------
// 3) Additional Conditions - FVG Verification (Volume, Gap Size)
//------------------------------------------------------------------------------
vol  = volume > ta.sma(volume, 10)
batr = (low - high[2]) > ta.sma(low - high[2], lnt) * 1.5
satr = (high - low[2]) > ta.sma(high - low[2], lnt) * 1.5

//------------------------------------------------------------------------------
// 4) Sum of Bullish / Bearish FVG within the Last lnt Bars
//------------------------------------------------------------------------------
countup   = math.sum(bfvg ? 1 : 0, lnt)      // +1 for each BFVG
countdown = math.sum(sfvg ? -1 : 0, lnt)     // -1 for each SFVG

//------------------------------------------------------------------------------
// 5) Verification (e.g., Require Higher Volume or Large Gap)
//------------------------------------------------------------------------------
verifyb = (bfvg and vol[1]) or (bfvg and batr)
verifys = (sfvg and vol[1]) or (sfvg and satr)

//------------------------------------------------------------------------------
// 6) Normalized Gap Values
//------------------------------------------------------------------------------
normb = ((low - high[2]) * countup * 0.75) / ta.highest(low - high[2], lnt)
norms = ((high - low[2]) * countdown * 0.75) / ta.lowest(high - low[2], lnt)

//------------------------------------------------------------------------------
// 7) Total Net FVG Count + Calculation of Maximum for fill()
//------------------------------------------------------------------------------
totcount = countup + countdown
max      = math.max(
               ta.highest(countup, 200), 
               ta.highest(math.abs(countdown), 200)
           )

//------------------------------------------------------------------------------
// 8) Plotting Values (as in an indicator – can be kept for visualization)
//------------------------------------------------------------------------------
up   = plot(countup,     "Buy FVG",  color=upcol,  display=display.none)
down = plot(countdown,   "Sell FVG", color=dncol,  display=display.none)
zero = plot(0, "", color.new(color.gray, 100), display=display.none, editable=false)

// Net Value (sum of FVG)
plot(totcount, "Net Value", color=color.new(color.gray, 50))

// Filling areas above/below zero

plot(verifyb ? normb : na, "Long Pattern Width",  color=upcol,  linewidth=1, style=plot.style_histogram)
plot(verifys ? norms : na, "Short Pattern Width", color=dncol, linewidth=1, style=plot.style_histogram)

//------------------------------------------------------------------------------
// 9) Simple Trading Logic (STRATEGY)
//------------------------------------------------------------------------------
// - If "verifyb" is detected, go long.
// - If "verifys" is detected, go short.
//
// You can extend this with Stop Loss, Take Profit, 
// closing old positions, etc.
//------------------------------------------------------------------------------
bool goLong  = verifyb
bool goShort = verifys

// Basic example: Open Long if verifyb, Open Short if verifys.
if goLong
    // First close any short position if it exists
    if strategy.position_size < 0
        strategy.close("Short FVG")
    // Then open Long
    strategy.entry("Long FVG", strategy.long)

if goShort
    // First close any long position if it exists
    if strategy.position_size > 0
        strategy.close("Long FVG")
    // Then open Short
    strategy.entry("Short FVG", strategy.short)