Skip to main content
Glama
staskh

trading-skills

by staskh

ib_0dte_ema_vix

Select and optionally place 0DTE credit spreads by applying EMA9/21 cross and VIX/VXN volatility gates, ranking candidates, and executing a dry run or live combo order.

Instructions

Find (and optionally place) the best 0DTE credit spread via the EMA + VIX/VXN strategy.

Reads closed 12-min IB bars + the live vol index, applies the vol gate, then auto-selects bull_put or bear_call from the EMA9/EMA21 cross before ranking spreads. NDX/QQQ are gated on VXN (Nasdaq-100 vol); all other symbols on VIX. Returns success=False with a reason when a gate blocks the trade (VIX-SKIP / no-cross / EMA-Dn-no-RR / missing-bars).

Default is a bare EMA cross runnable any time of day; enable the optional confirmation gates per call. Default is a dry run — pass execute=True to place a live combo order with the automatic OCA exit bracket. Requires TWS or IB Gateway running locally.

Args: symbol: Underlying (e.g. NDX, SPX, RUT, QQQ, SPY) budget: Max capital at risk in dollars (default 50000) port: IB port (7496 for live, 7497 for paper) vix_threshold: Skip if vol index >= this. Default is per-index: VXN 30 for NDX/QQQ, VIX 20 otherwise. target_delta: Short-leg delta target (default 0.11 bear call / 0.07 bull put) rr_gate: Require red→red (today's two most recently closed bars both red) to confirm a Bear Call time_gate: Require today's bars from 9:30 through 10:30 ET (run at 10:30 ET+) and anchor the EMA-cross lookback to the last bar closing by 10:30 ET bar_minutes: Bar size in minutes for the EMAs and gates (default 12) max_width: Cap the strike width in points (default 150; 0 = no cap) gex: Compute the dealer gamma-exposure profile top: Number of candidates to return (default 5) account: IBKR account for execution (required with execute when >1 managed account) execute: Place the chosen spread as a live combo order (default False = dry run) pick: 1-based rank of the candidate to execute (default 1 = best) limit_frac: Walk between the marketable combo credit (0) and mid (1.0) at execution

Input Schema

NameRequiredDescriptionDefault
gexNo
topNo
pickNo
portNo
budgetNo
symbolYes
accountNo
executeNo
rr_gateNo
max_widthNo
time_gateNo
limit_fracNo
bar_minutesNo
target_deltaNo
vix_thresholdNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.21.1
    • addedInput schema / properties / bar_minutes
      Added value: +{
      +  "default": 12,
      +  "title": "Bar Minutes",
      +  "type": "integer"
      +}
    • changedInput schema / properties / max_width / default
      Previous value: -nullNew value: +150
  2. Addedv0.18.1

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full behavioral burden and does so well: it discloses data sources (closed 12-min bars and live vol index), gate failure behavior with named reasons, dry-run default, live combo order placement with automatic OCA exit bracket, and local TWS/IB Gateway dependency. It also notes the account requirement for execution when multiple accounts are managed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with purpose and behavior, then organized into a clean Args section for a complex 15-parameter tool. Despite its length, every sentence carries operational information needed to call the tool correctly, with no redundant repetition of schema titles.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex financial execution tool with no output schema, the description covers strategy behavior, gates, execution side effects, and parameter semantics thoroughly. However, it does not describe the success return shape beyond failure reasons, so an agent does not know exactly what a successful ranked-candidate payload looks like.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, but the description documents all 15 parameters in an Args section with defaults, units, and nuanced behavior. It adds meaning beyond the bare schema, such as per-index VIX thresholds, delta targets differing by strategy leg, rr_gate and time_gate semantics, max_width 0 meaning no cap, and limit_frac execution walk behavior.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: find and optionally place the best 0DTE credit spread using an EMA + VIX/VXN strategy. It further distinguishes the tool by naming the exact strategy logic (bull_put vs bear_call selection, vol gate, ranking), so an agent can tell it apart from generic spread or scan siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It clearly explains when to use the default bare EMA cross versus enabling confirmation gates per call, and it documents the dry-run default with execute=True as the live-order path. It does not compare this tool to sibling spread tools or explicitly state when another tool would be preferable, keeping it below a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.