Python-based options signal engine
Regime-adaptive strategy selection for Iron Condors, Credit Spreads, and WAIT states
Outputs: Discord, email, and SMS support in development
MEIC is a regime-aware options signal engine designed to classify
market conditions and recommend the strategy best aligned with the
current environment. It evaluates closed-bar trend, volatility,
structure, and timing inputs to produce one of four outcomes:
ENTER_IC, ENTER_CS_CALL,
ENTER_CS_PUT, or WAIT. betterprogramming
The engine is designed to reduce poor strategy selection during trend acceleration, volatility expansion, mixed momentum states, and structurally unclear sessions. Its primary objective is not to maximize trade frequency, but to improve selectivity and preserve strategy alignment with regime conditions. atlassian
MEIC determines whether the market environment is better suited to a neutral premium-selling structure, a directional spread structure, or no position at all.
This decision framework is intended to prevent neutral structures from being deployed into active breakouts and to avoid directional entries when market structure lacks confirmation.
MEIC is organized into four core layers:
This layered design separates raw market interpretation from final trade-type selection, allowing the regime logic to remain explicit and auditable. dev
The data layer processes OHLCV inputs for supported underlyings including major index products, ETFs, and selected futures instruments. Time normalization is applied consistently so that all downstream classification logic evaluates the same session context.
The data model is structured around closed-bar evaluation, which prevents intrabar instability from contaminating strategy selection. This makes each decision state deterministic relative to the most recently confirmed bar.
The indicator engine computes the directional and regime inputs used by the Strategy-Picker.
| Indicator | Primary role |
|---|---|
| VWAP | Institutional bias and mean-reference context |
| EMA-8 | Short-term directional state |
| MACD | Momentum direction |
| ADX / DI+ / DI- | Trend strength and directional dominance |
| CCI or RSI | Timing confirmation |
| Intraday VWAP | Session-anchored mean-reversion context |
These components are not treated as isolated signals. Instead, they are combined into a vote-based and regime-based classification model that determines whether the environment is neutral, bullish, bearish, or unsuitable for entry.
The Strategy-Picker is the decision core of MEIC. It evaluates directional votes, trend strength, timing bias, and regime consistency before classifying the current environment.
Directional context is built from:
These inputs accumulate into bull and bear vote groupings rather than forcing a single-indicator decision. This allows the system to measure directional agreement across the indicator stack before a strategy type is considered.
ADX is used to distinguish low-strength environments from stronger directional conditions.
Timing confirmation can be supplied by either CCI or RSI, depending on configuration.
The Strategy-Picker resolves the market into one of three states:
| Regime | Interpretation |
|---|---|
| NEUTRAL | Balanced and low-trend; candidate for Iron Condor |
| BULL | Directionally constructive; candidate for directional spread logic |
| BEAR | Directionally weak; candidate for directional spread logic |
This regime output is then mapped into a strategy recommendation.
ENTER_IC is reserved for neutral environments where
directional pressure is limited and price action remains balanced around
core reference levels.
Typical conditions include:
This keeps Iron Condor selection tied to range-like conditions rather than allowing neutral premium structures to drift into breakout environments.
ENTER_CS_CALL and ENTER_CS_PUT are used
when the market exhibits stronger directional behavior and the regime
model resolves clearly.
Typical conditions include:
This protects the engine from recommending Iron Condors during expanding directional phases and improves consistency between strategy type and market structure.
WAIT is a deliberate output, not a null state. It is
produced when the signal environment is ambiguous, transitional,
contradictory, or structurally incomplete.
Typical triggers include:
WAIT functions as a protection layer that prevents forced strategy selection when the regime model lacks sufficient agreement.
MEIC can trade both structure families at once, or be restricted to a
single family. This is controlled by the --only
setting:
| Mode | Setting | Trades | Observes (logged, not traded) |
|---|---|---|---|
| Iron Condor only β default | --only ic |
Iron Condors on neutral days | Directional Credit Spreads |
| Credit Spread only | --only cs |
Call / Put Credit Spreads on directional days | Iron Condors |
| Both | --only both |
Iron Condors and Credit Spreads | β |
By default MEIC runs in Iron Condor mode: it takes
ENTER_IC signals on neutral days, while directional
ENTER_CS_CALL / ENTER_CS_PUT signals are still
computed and alerted as observe-only β logged for the record,
never traded. Switching to --only cs inverts this (trade the
directional spreads, observe the condors). --only both
trades whichever structure the regime selects each cycle β an Iron Condor
when the Strategy-Picker reads NEUTRAL, a directional Credit Spread when
it reads BULL or BEAR. In every mode the observe-only side is still
surfaced, so the full regime read stays auditable regardless of what is
being traded.
MEIC also supports staggered multiple-entry β the βmulti-entryβ the name refers to. With multiple-entry enabled, each qualifying poll may open another position alongside those already working, up to a concurrency cap, so a session can be laddered into over time rather than committed on a single entry.
Spread width is set per structure and per underlying, because a single global width is not safe across products that quote on different strike increments.
| Structure | SPX | SPY / QQQ | IWM |
|---|---|---|---|
| Credit Spread (single directional) | 20 | 2 | 1 |
| Iron Condor (per side) | 25 | per config | per config |
The Iron Condor deliberately uses a wider per-side spread (25 on SPX) than the single directional Credit Spread (20 on SPX). Each Iron Condor side must independently clear its own per-side credit floor, so the wider wings earn more premium per side toward that floor while keeping both spreads defined-risk.
Every position is defined-risk and is managed off a live reprice of its own wings on each poll cycle. A conservative mark is used β pay the ask to buy back the short leg, receive only the bid on the long leg β so take-profit and stop-loss reflect what is actually closeable rather than an optimistic mid. A sanity guard rejects any reprice that falls outside a spread's structural bounds, so a thin or stale quote can never mis-fire an exit.
Both targets are fixed at entry as a percentage of the credit received:
tp_debit = credit Γ (1 β 70%)). Example:
a $3.00 credit is taken profit at a $0.90 buy-back.sl_debit = credit Γ 195%). Example: a $3.00 credit stops
out at a $5.85 buy-back.These two thresholds apply per wing to both structures β a Credit Spread's single wing and each of an Iron Condor's two wings are evaluated the same way, in the same order every cycle: expiration settlement first, then take-profit, then stop-loss. The 70% take-profit is the exit when it is reached, not a guarantee it will be: a position that touches neither threshold during the session simply settles at expiration. In practice that makes end-of-day settlement a common outcome on quiet 0DTE days β especially for a single directional Credit Spread, which only reaches the 70% target on a clean favorable move, whereas an Iron Condor's away-from-price side decays faster and trips the take-profit more often.
Smaller, thinner-premium underlyings (SPY / QQQ / IWM) override these to ride to full credit capture (100% take-profit β let the spread expire worthless) with a 1.5Γ stop, because closing a $0.50β$1.00 credit early is not worth the bid/ask friction.
A Credit Spread is a single wing: it runs to its own take-profit, its own stop-loss, or end-of-day settlement β whichever comes first.
An Iron Condor is two wings β a put spread and a call spread β each tracked and managed independently on its own take-profit and stop-loss. On top of that, the Iron Condor adds a companion-close rule: once one side is stopped out, the neutral thesis behind the whole position is broken, so the still-open side is closed as well β but only if it can be closed for a profit (buy-back cheaper than the credit it was sold for). If the surviving side is underwater, it is left to ride under its own take-profit and stop-loss rather than lock in extra loss. End-of-day settlement still closes anything left open.
MEIC includes multiple safeguards designed to reduce poor-quality signals.
Signals are restricted to approved evaluation windows so that strategy selection occurs within the intended session context.
ADX is used to prevent neutral structures from being suggested during active directional expansion.
A strategy candidate becomes valid only when the relevant components of the indicator stack support the same regime interpretation.
Iron Condors require balance, not simply low volatility. The engine checks for limited directional dominance, weak trend pressure, and proximity to reference levels before classifying the market as neutral.
For spread and condor candidates, suggested structures are filtered through width, out-of-the-money alignment, and credit constraints. If the structure does not meet the quality thresholds, the signal is not advanced.
MEIC produces structured alerts for the following outcomes:
Alert payloads can include:
| Channel | Status | Purpose |
|---|---|---|
| Discord | Active | Structured signal delivery |
| Active | Text-based alert output | |
| SMS | In development | Lightweight notification layer |
The alert layer is intended to support both human review and downstream ingestion.
MEIC is a regime-adaptive options signal engine built to:
MEIC is not a trade-frequency engine and is not intended to force participation in unclear markets. Its role is selective regime classification, options strategy recommendation, and structured alert generation.
MEIC is designed for: