세션 VWMA 기반 일중 합성 옵션 전략: 롱 및 숏 신호를 위한 적응형 거래 시스템

VWMA ATM IST
생성 날짜: 2025-02-24 10:07:39 마지막으로 수정됨: 2025-02-27 16:46:17
복사: 0 클릭수: 354
avatar of ianzeng123 ianzeng123
2
집중하다
319
수행원

세션 VWMA 기반 일중 합성 옵션 전략: 롱 및 숏 신호를 위한 적응형 거래 시스템 세션 VWMA 기반 일중 합성 옵션 전략: 롱 및 숏 신호를 위한 적응형 거래 시스템

개요

이것은 거래량 가중 이동 평균 ((VWMA) 을 기반으로 한 일일 거래 전략이며, 합성 옵션 포트폴레오를 통해 다중 하위 양방향 작업을 수행한다. 전략의 핵심은 매 거래일 재 계산된 VWMA 지표이며, 가격과 VWMA의 상대적인 위치에 따라 거래 신호를 생성하고, 종결 전에 자동으로 평정한다. 이 전략은 포지션 관리 및 거래 빈도 제한을 포함한 좋은 위험 제어 장치가 있다.

전략 원칙

전략의 핵심 논리는 다음과 같은 점에 기초합니다.

  1. 매일 재배치된 VWMA를 동적 트렌드 지표로 사용함
  2. 가격이 VWMA를 넘어서면 포지션 포트폴리오를 만듭니다.
  3. 가격이 VWMA 아래로 떨어지면 하향 포트폴리오를 구성합니다.
  4. 15시 29분 (IST) 에 모든 지분을 강제적으로 매각한다.
  5. hasExited 변수를 도입하여 상장 빈도를 제어하고 과도한 거래를 방지합니다.
  6. 동방향 돌파구에 대한 피라미드형 부양을 지원하는

전략적 이점

  1. 역동적으로 적응 - VWMA의 매일 재설정으로 지표가 항상 현재의 시장 상황을 반영합니다.
  2. 위험과 이익의 균형 - 합성 옵션 포트폴리오를 통해 위험을 제한하고 수익 잠재력을 유지합니다.
  3. 엄격한 거래 규율 - 명확한 입시, 부가 및 강제 청산 메커니즘
  4. position sizing 유연성 - 퍼센티지 포지션 관리 지원
  5. 동작 논리가 명확하다 - 신호 생성 조건은 간단하고 직관적이다

전략적 위험

  1. 흔들리는 시장 위험 - VWMA 돌파구가 가로판 시장에서 빈번한 잘못된 신호를 일으킬 수 있다
  2. 격차 위험 - 하룻밤 사이에 큰 변동으로 인해 큰 손실이 발생할 수 있습니다.
  3. 옵션 포트폴리오 위험 - 합성 옵션의 델타 중립 편향
  4. 실행 슬라이드 포인트 - HFT 거래는 더 큰 슬라이드 포인트에 직면 할 수 있습니다.
  5. 자본 효율성 - 매일 매매를 의무화하면 거래 비용이 증가합니다

전략 최적화 방향

  1. 변동률 필터를 도입하여 높은 변동률 환경에서 정책 파라미터를 조정합니다.
  2. 트렌드 확인 지표를 늘리고, 가짜 돌파구로 인한 손실을 줄여라.
  3. 수직 격차 전략을 도입하는 것을 고려하는 것과 같은 옵션 포트폴리오 구조를 최적화
  4. 시장 상황에 따라 동적으로 조정되는 적응형 VWMA 주기
  5. 최대 철수 제한과 같은 더 많은 위험 관리 지표를 추가합니다.

요약하다

이 전략은 전체적인 구조와 논리적으로 엄격한 일일 거래 전략이다. VWMA 지표를 통해 단기 트렌드를 포착하고, 합성 옵션 포트폴리오와 결합하여 거래하며, 좋은 위험 제어 메커니즘을 가지고 있다. 전략의 최적화 공간은 주로 가짜 신호를 줄이고, 실행 효율성을 높이고, 위험 관리 시스템을 개선하는 데 있다.

전략 소스 코드
/*backtest
start: 2025-02-16 00:00:00
end: 2025-02-23 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Binance","currency":"SOL_USDT"}]
*/

//@version=5
strategy("Session VWMA Synthetic Options Strategy", overlay=true, initial_capital=100000, 
     default_qty_type=strategy.percent_of_equity, default_qty_value=10, pyramiding=10, calc_on_every_tick=true)

//──────────────────────────────
// Session VWMA Inputs
//──────────────────────────────
vwmaLen   = input.int(55, title="VWMA Length", inline="VWMA", group="Session VWMA")
vwmaColor = input.color(color.orange, title="VWMA Color", inline="VWMA", group="Session VWMA", tooltip="VWMA resets at the start of each session (at the opening of the day).")

//──────────────────────────────
// Session VWMA Calculation Function
//──────────────────────────────
day_vwma(_start, s, l) =>
    bs_nd = ta.barssince(_start)
    v_len = math.max(1, bs_nd < l ? bs_nd : l)
    ta.vwma(s, v_len)

//──────────────────────────────
// Determine Session Start
//──────────────────────────────
// newSession becomes true on the first bar of a new day.
newSession = ta.change(time("D")) != 0

//──────────────────────────────
// Compute Session VWMA
//──────────────────────────────
vwmaValue = day_vwma(newSession, close, vwmaLen)
plot(vwmaValue, color=vwmaColor, title="Session VWMA")

//──────────────────────────────
// Define Signal Conditions (only on transition)
//──────────────────────────────
bullCond = low > vwmaValue      // Bullish: candle low above VWMA
bearCond = high < vwmaValue     // Bearish: candle high below VWMA

// Trigger signal only on the bar where the condition first becomes true
bullSignal = bullCond and not bullCond[1]
bearSignal = bearCond and not bearCond[1]

//──────────────────────────────
// **Exit Condition at 15:29 IST**
//──────────────────────────────
sessionEnd = hour == 15 and minute == 29

// Exit all positions at 15:29 IST
if sessionEnd
    strategy.close_all(comment="Closing all positions at session end")

//──────────────────────────────
// **Trade Control Logic**
//──────────────────────────────
var bool hasExited = true  // Track if an exit has occurred since last entry

// Reset exit flag when a position is exited
if strategy.position_size == 0
    hasExited := true

//──────────────────────────────
// **Position Management: Entry & Exit**
//──────────────────────────────
if newSession
    hasExited := true  // Allow first trade of the day

// On a bullish signal: 
//   • If currently short, close the short position and then enter long
//   • Otherwise, add to any existing long position **only if an exit happened before**
if bullSignal and (hasExited or newSession)
    if strategy.position_size < 0
        strategy.close("Short", comment="Exit Short on Bull Signal")
        strategy.entry("Long", strategy.long, comment="Enter Long: Buy Call & Sell Put at ATM")
    else
        strategy.entry("Long", strategy.long, comment="Add Long: Buy Call & Sell Put at ATM")
    hasExited := false  // Reset exit flag

// On a bearish signal: 
//   • If currently long, close the long position and then enter short
//   • Otherwise, add to any existing short position **only if an exit happened before**
if bearSignal and (hasExited or newSession)
    if strategy.position_size > 0
        strategy.close("Long", comment="Exit Long on Bear Signal")
        strategy.entry("Short", strategy.short, comment="Enter Short: Buy Put & Sell Call at ATM")
    else
        strategy.entry("Short", strategy.short, comment="Add Short: Buy Put & Sell Call at ATM")
    hasExited := false  // Reset exit flag

//──────────────────────────────
// **Updated Alert Conditions**
//──────────────────────────────
// Alerts for valid trade entries
alertcondition(bullSignal and (hasExited or newSession), 
     title="Long Entry Alert", 
     message="Bullish signal: BUY CALL & SELL PUT at ATM. Entry allowed.")

alertcondition(bearSignal and (hasExited or newSession), 
     title="Short Entry Alert", 
     message="Bearish signal: BUY PUT & SELL CALL at ATM. Entry allowed.")