セッション VWMA に基づく日中合成オプション戦略: ロングおよびショート シグナルの適応型取引システム

VWMA ATM IST
作成日: 2025-02-24 10:07:39 最終変更日: 2025-02-27 16:46:17
コピー: 0 クリック数: 354
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. ポジションサイジングの柔軟性 - ポジション管理の割合をサポート
  5. 操作ロジックは明確 - 信号生成条件はシンプルで直感的です

戦略リスク

  1. 震動市場リスク - VWMAの突破は横盤市場で頻繁に偽信号を生じさせる可能性がある
  2. ギャップリスク - 一夜間の大幅な変動により大きな損失が生じる可能性がある
  3. オプションポートフォリオリスク - 合成オプションのデルタ中性偏差
  4. 実行滑点 - 高周波取引は大きな滑点に直面する可能性があります
  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.")