Complete technical blueprint, mathematical foundation, and implementation rationale for dynamic multi-stage partial profit booking and runner allocation across live market regimes.
In Indian derivative option buying on the NIFTY 50 index, static profit-taking is inherently flawed. A static model that books fixed percentages (e.g., 40% @ 1.5R, 30% @ 3.0R, 15% @ 5.0R) inevitably suffers from two structural failure modes:
On persistent expansion days (ADX ≥ 28, directional institutional day), banking 40% at +1.5R prematurely strips position weight from the trade. By the time NIFTY surges 150–250 points, the account is left with only 15% runner capacity, leaving vast chunks of expectancy unharvested.
In range-bound markets or liquidity sweeps, waiting for +3.0R or +5.0R leads to sudden, aggressive price rejections at opposing structural extremes. Open profits evaporate into stop-outs before later milestones are ever touched.
On Tuesday afternoons post-13:00 IST, non-linear theta decay accelerates dramatically. A runner position idling for 20 minutes without new highs will suffer crushing premium erosion even if the underlying index merely consolidates.
The Solution: The Adaptive Regime-Aware Scaling Engine conditions the milestone allocations, R-multiples, and stop loss ratchet speeds on live market telemetry (ADX, Market Regime, Strategy Classification, and Time-to-Expiry).
QuadraTrades dynamically classifies every trade into one of four distinct scaling profiles at order origination:
Selected for TrendDayRunner, FirstPullback, or any directional signal with ADX ≥ 28.
Standard expansion setups, moderate volatility, or general breakout continuations.
Triggered for FailedBreakout, LiquiditySweepReversal, SniperLiquidityReversal, or ADX < 22.
Triggered for ExpiryGammaBlast, explicit expiry flags, or Tuesday trading post-13:00 IST.
When an entry signal arrives, resolve_scaling_profile() executes a deterministic resolution hierarchy to guarantee the correct allocation without ambiguity:
If the strategy or manual operator specified metadata["scaling_profile"], respect that directly.
If strategy_name == "ExpiryGammaBlast", or is_expiry == True, or current day is Tuesday (weekday 1) and timestamp ≥ 13:00 IST → Select EXPIRY_GAMMA.
If strategy is FailedBreakout, LiquiditySweepReversal, SniperLiquidityReversal, OR market regime is RANGE, CHOPPY, REVERSAL, OR ADX < 22.0 → Select QUICK_HARVEST.
If strategy is TrendDayRunner, FirstPullback with ADX ≥ 25, or regime is TREND_UP/DOWN with ADX ≥ 28.0 → Select TREND_RUNNER.
For standard breakout continuations or unclassified expansion regimes → Select STANDARD_BALANCED.
In live Indian exchange trading (NSE F&O), contracts can only be traded in exact integer multiples of the lot size (e.g., 25 or 65 shares). Fractional lots are strictly rejected by broker APIs. QuadraTrades enforces robust integer discretization:
| Initial Position | Profile | Milestone 1 | Milestone 2 | Milestone 3 | Final Runner |
|---|---|---|---|---|---|
| 1 Lot (65 shares) | Any Profile | 0 shares (Stop → BE) | 0 shares (Stop → Lock) | 0 shares | 1 Lot (100% Runner) |
| 4 Lots (260 shares) | TREND_RUNNER |
1 Lot (65 shares) @ +1.5R | 1 Lot (65 shares) @ +3.0R | 1 Lot (65 shares) @ +5.0R | 1 Lot (25% Runner) |
| 4 Lots (260 shares) | QUICK_HARVEST |
2 Lots (130 shares) @ +1.5R | 1 Lot (65 shares) @ +2.5R | — | 1 Lot (25% Runner) |
| 5 Lots (325 shares) | EXPIRY_GAMMA |
2 Lots (130 shares) @ +1.5R | 2 Lots (130 shares) @ +2.5R | — | 1 Lot (20% Runner) |
| 10 Lots (650 shares) | TREND_RUNNER |
2 Lots (130 shares) @ +1.5R | 2 Lots (130 shares) @ +3.0R | 2 Lots (130 shares) @ +5.0R | 4 Lots (40% Runner) |
A successful runner engine must systematically lock in gains without choking normal market pullbacks. QuadraTrades utilizes a 5-tier stop ratchet architecture:
When Milestone 1 triggers, stop loss automatically advances to entry_price + breakeven_buffer (default +1.0 pt), completely eliminating financial risk on the trade.
When Milestone 2 triggers, stop loss ratchets to guarantee at least +2.0R (or +1.8R in Quick Harvest), preventing open profits from collapsing back to breakeven.
When Milestone 3 triggers, stop loss ratchets to guarantee +3.0R minimum profit, while remaining shares enter uninhibited structural 5m trailing.
Once peak R ≥ 1.5R, stop ratchets dynamically:
• 1.5R to 2.5R: Locks 65% of peak gain
• 2.5R to 4.0R: Locks 75% of peak gain
• ≥ 4.0R: Locks 80% of peak gain
Post-13:00 IST, if an option in profit makes no new high for 25 minutes (or 15 minutes under EXPIRY_GAMMA), the stop aggressively snaps to 85% of peak gains.
Test trade allocations, realized profits, and stop ratchets across any configuration in real-time:
Simulates exchange lot allocation and stop ratchets.
The system was implemented with 100% backward compatibility across four key modules: