Strategy 7 — Iron Condor Fallback (IC)
The Iron Condor is a fallback strategy for range-bound NIFTY weeks. It is deliberately lower priority than the calendar strategies: run_scan_cycle() scans IC only after DC, DCS, DCS_SKEW, and DDC have had their chance, and only if none of those strategies is open.
Go-live safety
IC_DRY_RUN=True seeds the SQLite records only on first run.
Runtime state is changed with /shadow IC, /promote IC, and /revert IC. Shadow/live IC entries buy hedge legs first, then sell short legs, and require available balance ≥ IC_MAX_MARGIN × 1.10.
Structure
SELL
Short PE
ATM - 300
credit leg
BUY
Long PE
ATM - 500
downside hedge
SELL
Short CE
ATM + 300
credit leg
BUY
Long CE
ATM + 500
upside hedge
Entry Filters
| Filter | Default | Reason |
|---|---|---|
| Fallback guard | No open DC, DCS, DCS_SKEW, or DDC | IC is only a fallback when the primary dry-run options strategies are idle. |
| Duplicate guard | No open IC | Prevents stacking identical fallback risk. |
| DTE | IC_DTE_MIN=3 to IC_DTE_MAX=7 | Uses the near weekly expiry window. |
| ATM IV | IC_MIN_IV=18% to IC_MAX_IV=26% | Needs enough credit, but avoids high-event-vol regimes. |
| Realized range | Today's range ≤ IC_MAX_RANGE_PCT × near ATM straddle | Only enter if observed intraday movement is narrow versus priced range. |
| Minimum credit | Net credit ≥ IC_MIN_CREDIT_PCT × wing width × lot | Rejects thin credit where defined risk is not compensated. |
| Margin cap | Max loss ≤ IC_MAX_MARGIN | Per-lot capital guard before simulated entry is persisted. |
| Regime gate (OR) | AI market_view permits OR same-cycle TA snapshot regime is RANGE | IC sells range/vol — it enters when either confirmation is present. It is blocked only when a gate has an opinion and neither permits; with no AI view and no TA snapshot it fails open. The TA snapshot is refreshed before the IC scan each cycle (_refresh_cycle_ta_snapshot), so a strict AI veto (blocked_by_ai) can still be rescued by a confirmed RANGE regime. |
Signal + Persistence
# Scanner signal
short_ce = ATM + IC_OTM_DISTANCE_PTS
long_ce = short_ce + IC_WING_WIDTH_PTS
short_pe = ATM - IC_OTM_DISTANCE_PTS
long_pe = short_pe - IC_WING_WIDTH_PTS
net_credit = (short_ce_ltp + short_pe_ltp - long_ce_ltp - long_pe_ltp) * lot_size
wing_width = IC_WING_WIDTH_PTS * lot_size
max_loss = wing_width - net_credit
# Persisted open trade keys include all 4 ids/strikes, entry_credit, wing_width, max_loss, entry_time, lots.
Exit Rules
| Condition | Action | P&L Source |
|---|---|---|
Credit captured ≥ IC_PROFIT_TARGET_PCT × entry credit | Close all 4 legs | Live LTP simulation |
Current loss ≥ IC_STOP_LOSS_CREDIT_X × entry credit | Close all 4 legs | Live LTP simulation |
| Expiry day at/after 15:00 IST, or expiry already passed | Time stop | Live LTP if available, otherwise entry credit fallback |
current_credit_value = (short_ce_ltp + short_pe_ltp - long_ce_ltp - long_pe_ltp) * lot_size
current_pnl = entry_credit - current_credit_value
# Positive P&L means the IC credit spread has decayed since entry.