Browse docs
Docs / Strategy Configuration & Usage

Strategy Configuration & Usage

Building a new strategy? Assemble it from blocks in the Strategy Composer (/strategy-composer) — no code required.

Scanning the option chain, not running a strategy? The Option Scanner (/option-scanner) is a separate, read-only research tool — no position or strategy needed.


Dashboard Overview

The Dashboard (/) is the main control panel. It lists every runnable strategy and provides controls for each. Archived strategies (see below) are hidden from this list; they live in the collapsed Archived panel underneath it.

Two filters sit to the right of the Strategies heading: a Mode dropdown (All / Paper / Real) and an Auto on only switch that hides every strategy whose Automation switch is off. They combine — Mode Real + Auto on only shows just the strategies that will actually place live orders today. Both remember your choice in the browser across reloads.


Managing Strategies

Edit a Strategy

Open ⋮ → Edit in Composer on any strategy row to open its configuration in the Strategy Composer. Modify and save there.

Clone a Strategy

Open ⋮ → Clone, give it a new file name and display name. The clone always starts disabled, in Paper mode, with the source's params carried over — so you can safely tweak a copy without touching the strategy that's actually running.

Archive a Strategy

Open ⋮ → 🗄 Archive Strategy to take a strategy out of the active dashboard list without deleting it — useful for strategies you're not running right now but don't want to lose the code/config for.

  • The strategy must be off (Automation) and have no open position first — archiving refuses with an error otherwise.
  • Archiving disarms it (if armed) and removes any scheduled jobs for it.
  • The file and its metadata (params, mode, broker) are kept as-is, just hidden from the main list.

Archived strategies live in the Archived (N) panel below the strategy grid. From there:

  • Restore — un-archives it back into the active list (still disabled; re-enable and re-schedule it manually).
  • ✕ Delete Permanently — same destructive delete as below, for archived strategies you actually want gone.

Delete a Strategy

Open ⋮ → ✕ Delete Strategy (available on both active and archived strategies). The file is removed from strategies/ and its metadata is cleared — this cannot be undone. If you just want it out of the way but might come back to it, Archive instead.


Strategy Controls (per row)

Each strategy card has two independent controls: Automation (is it scheduled?) and Money mode (Paper or Real?). Together they cover every real workflow — including running the schedule in Paper mode to validate a strategy for a few days before ever risking money.

Automation Switch

The toggle switch at the far right of the card header.

State Effect
On Creates the strategy's entry + monitor jobs (see Scheduling) and lets them fire
Off Removes those scheduled jobs entirely

Turning it off while a Real strategy has an open position asks for confirmation first — pausing automation stops exit monitoring, and you'll need to manage that position manually.

Money Mode (Paper / Real)

The Paper / Real buttons in the card header. Switching to Real is the arm action — there's no separate arm step.

Mode What happens
Paper Strategy logic runs, prices are fetched, decisions are made — but no Kite orders are placed. P&L is tracked on paper.
Real Confirms today's P&L, then arms the strategy and places live market orders at market price (NRML product) via that strategy's configured broker (Kite, Breeze, or Dhan — see the broker dropdown on the card) on every subsequent run — manual or scheduled.

Switching a Real strategy with an open position back to Paper asks for confirmation first, for the same reason as Automation-off above. The mode takes effect immediately — no rescheduling needed.

Always validate a strategy with Scheduled + Paper for a few trading days, review the results on the Performance page, then switch to Real.

⚠ Re-arm — if a strategy is Real but shows this link instead of a plain Real badge, it's been auto-disarmed by the daily loss-limit circuit breaker (or a manual disarm via the API) without being switched back to Paper. Click it to re-confirm and resume live trading.

Config (Lots & Monitor Interval)

Open ⋮ → Config to open the strategy parameter modal.

Lots — the number of lots to trade per run.

Lots NIFTY units Approx capital at ₹5 net debit
1 65 ₹325
3 195 ₹975
5 325 ₹1,625
10 650 ₹3,250

Monitor Interval — how frequently the monitor runs, in minutes. Applies to both:

  • Fullday simulation — controls the number of ticks replayed between 10:00 and 15:20
  • Real-time scheduled jobs — sets the cron frequency of the monitor job
Interval Ticks per day (10:00–15:20)
1 min 320
5 min 64
10 min 32
15 min 21
30 min 11

Available options: 1, 2, 3, 5, 10, 15, 30 minutes. Only intervals that divide 60 evenly are offered, since the real-time cron expression */N resets at each hour boundary.

Click Save. Both values are stored in strategies/metadata.json and injected into every subsequent run — manual, simulated, and scheduled. If the strategy is currently Scheduled, saving also replaces its jobs with the updated interval/entry-time — no need to re-schedule by hand.


Running a Strategy

Trade Status

A compact status line appears below the parameter row for each strategy whenever a trade state file exists.

Indicator Meaning
● LIVE ACTIVE Live trade is open, short legs running
◑ LIVE SHORT CLOSED Short legs exited; long legs still open. This is the only order it happens in — the engine always closes short legs before (or alongside) the long legs, force-closing a still-open short if the long's own exit fires first. Closing the long leg first would spike margin, since it's usually what's hedging the short's requirement.
○ LIVE CLOSED Trade fully closed
SIM … Same states but for the simulation state file

Click Details on the status line to open the Trade Status modal, which shows:

  • Full leg table (symbol, entry price, delta, IV)
  • ATM, net debit, profit target level, stop-loss level
  • Exit type and P&L (if applicable)
  • Live Chart — today's 1-minute candles for the open position (see below)

Live Chart

The Trade Status modal shows a live intraday chart, refreshed with the rest of the modal every 30 seconds. It appears only while the strategy has an open position on a trading day and automation is switched on — candles are fetched only for the strategy whose modal is open, so having many strategies on the dashboard costs nothing extra.

Use the dropdown to switch between:

  • Combined P&L (pts) — the signed sum across all open legs, drawn as a line against a dashed zero baseline. It is deliberately not a candle: the legs' highs don't occur at the same instant, so a summed high/low would be a price the position never actually printed.

  • One leg — real open/high/low/close candles for that option contract.

Illiquid legs. A deep-ITM or thinly traded strike doesn't print a candle every minute. Within the day that's handled by carrying the leg's last price forward, so the combined line stays continuous. But a leg that never prints at all is different: it appears in the dropdown as (no candle data) and the combined view is hidden rather than drawn, because summing only the legs that did trade produces a confident wrong P&L, not an approximate one. The per-leg views for the remaining legs still work. If you need the position's true P&L in that situation, read the Total P&L figure above the chart — it is computed from live LTP and does not depend on candle history.

If the chart is replaced by a short message instead, that is expected in any of these cases: automation is off, it isn't a trading day, there's no open position, or the broker can't serve candles. The last one is worth knowing per broker — Kite serves intraday candles normally, Breeze works but is slow, and Dhan requires a separate Data API subscription on their side, without which no candles are returned at all.

The footer keeps only the action that fits the trade's current state — Close Long Legs @ 15:20 when the short legs have exited, Preview Entry (and Place Entry Now once a preview comes back READY) otherwise. Everything rare or corrective sits under the ⋮ More menu:

Menu item What it does
🔔 Send update Sends the trade summary to every notification channel you have configured — email, Telegram, and/or webhook. Configure them under Settings; see setup.md.
⚙ Preview params… Scratch leg-selector overrides applied to the next preview only. Never used by a real entry.
Manual Entry… Record a position you already opened directly at the broker. No order is placed.
Mark Exited (Manual)… Record an exit you already did at the broker, at prices you enter. No order is placed. Leave a leg blank to keep it open — closing just the short legs moves the trade to SHORT_CLOSED instead of CLOSED. Each leg row also has a Close Now button that places a real MARKET order for that one leg only, instead of just recording a price.
Edit Trade State… Correct a mistake in the recorded trade — wrong price, symbol, or strike. If the trade shows ENTRY REJECTED — rolled back but the broker actually has the legs open (a rare fill-confirmation race), a Confirm Active (broker-verified) button appears — it re-checks broker.positions() for every rejected leg itself before changing anything, and changes nothing if any leg doesn't match.
⚠ Reset Live State / ⚠ Reset Sim State Delete the state file so a fresh entry can run. Confirmation dialog first; cannot be undone.

Reset Live State before starting a new week if the previous trade closed cleanly, or if you want to force a fresh entry during testing.

Manual takeover

Closing only some of a trade's legs — via Close Now on one leg, via Sq Off scoped to a leg (the strategy card's Sq Off button always closes everything currently open; a single-leg close is only available from the per-leg Close Now button above), or by leaving some rows blank in Mark Exited (Manual) — puts the whole strategy into manual control: it shows a ✋ MANUAL badge, and autopilot stops touching it entirely (no exits, no adjustments, no re-entry) until every remaining leg is closed, by hand or automatically. It resumes on its own the moment the position is fully flat — nothing to re-arm.


Manual Run

Click Run. The strategy executes immediately as a subprocess using the current mode and configured lots. A popup shows the return code, stdout, and stderr when it finishes.

Useful for on-demand testing or triggering a monitor check manually.

Simulate

Click Simulate to open the simulation modal. Simulations always run in paper mode regardless of the mode setting — no real orders are placed. Historical candle data is fetched from the broker selected in the modal's Broker dropdown (defaults to the strategy's own configured broker).

Date — any past trading day (Monday–Friday, market open). Click + End date to sweep a range instead of a single day.

Choosing a broker for simulations

All three brokers give the same thing here — real OHLC + volume candles — nothing more. None of them return implied volatility, open interest, Greeks, or bid/ask history through this app's simulation path, whatever their raw APIs otherwise advertise.

Broker What you actually get Best for
Breeze Real candles for the exact strike/expiry, retained well beyond a week — details Older/multi-day sims. Default for Multi-Day Sim.
Kite Real candles, but only while the exact contract is still in Kite's instruments master (~7 days after expiry) — details Recent sims (current or last week's expiry).
Dhan Real candles while listed; for anything expired, a spot-relative synthetic series (ATM±N, re-resolved per day) — an approximation, not that strike's real price history. Needs a separate Data API subscription. Quick checks when Breeze/Kite have nothing, with the approximation kept in mind.

Data availability check

Whenever the date, broker, or end date changes — and once as soon as the modal opens — the selected broker is probed for the data the run will actually need, and one of three verdicts appears before you commit to the run. This applies to single-day and date-range simulations alike; a single day is just a range where both ends are the same date.

Verdict Meaning
Data available Every trading day has index data, and ATM option candles were found on all sampled days.
Partial data Some days are missing index data, or option candles are missing on some sampled days. Those legs fall back to Black-Scholes estimates rather than real traded prices.
No data The broker returned nothing, or the date you picked is not an NSE trading day. The panel names the likely cause and which broker to use instead.

The check is a sample, not a guarantee — it reads one daily-candle series for the whole range plus an ATM option probe on up to three days, because proving every strike on every day would cost as much as running the simulation itself. Per-strike coverage is only confirmed once the run starts.

Typical causes of a failed check:

  • Kite — expired contracts drop out of Kite's instruments master, so older option legs can no longer resolve a token. Use Breeze for historical ranges.
  • Dhan — historical data requires a separate Data API subscription on the Dhan side.
  • Breeze — usually an illiquid strike or a date outside ICICI's retention.

Modes:

Mode Description
Full Day Runs entry at 09:45, then monitor at the configured interval from 10:00 to 15:20. Prints final P&L.
Entry only Runs only the 09:45 entry logic. Creates the state file. Does not monitor.
Monitor only Runs a single monitor check at the specified simulated time. Requires a state file (run Entry first).

Monitor Only — Simulated Time: Set hour and minute to check what the strategy would have decided at that exact moment. For example, set 11:30 to replay the 11:30 monitor tick.

To test the end-of-day long-leg exit, use Monitor at 15:20 on a day when DTE=1 (Monday, or the day before a Tuesday expiry).

Preview Strikes (optional, Full Day / Entry only)

Before running the simulation click Preview Strikes. The strategy scans all ITM strikes on the long expiry using the 09:45 candle data (or Black-Scholes fair values as a fallback) and returns two tables — one for the Long Call (LC) and one for the Long Put (LP).

Column Meaning
Strike that would be auto-selected by the strategy
Δ Black-Scholes delta
IV Implied volatility
LTP Last traded price (or BS fair value in sim)
Pass P1 = strict (Δ≥0.90, TV≥10) · P2 = relaxed TV · P3 = relaxed delta
  • Green row = your selection (overrides auto-select)
  • Blue row = auto-selected (used if you don't click a row)
  • If the skip filter would trigger on this date, a warning is shown and the simulation would produce no trade

Click any row to override the auto-selected strike, then click Run Simulation. The chosen strike is passed directly to the strategy, bypassing the fallback selection. If you don't click any row the strategy uses its normal auto-selection logic.

Extending a multi-day session

On a date-range simulation's results page (/multi-sim-results/<session>), Extend widens the same session with more days before the start date, after the end date, or both — instead of running a whole new session from scratch. Days already stored are skipped automatically; only the new days run.

Watch for legs held overnight. A carry_eod position can span the join between the old range and the new days. Extending earlier assumes the original run's first day started flat; extending later assumes nothing else has run this strategy in sim mode since this session finished. If a position turns out to be open across the join, the modal warns you up front, and if the run detects it after the fact, a banner on the results page names the affected day. Treat those numbers as unreliable and re-run the full range with Run Again if you need certainty.


Scheduling

How a strategy gets scheduled

Flipping the Automation switch on (see Strategy Controls) creates the two daily jobs required for live market operation:

Job name When it fires Strategy mode
<strategy>_entry Mon–Fri at 09:45 IST entry
<strategy>_monitor Mon–Fri every N min, 10:00–15:59 IST monitor

where N is the Monitor Interval set in Config (default 5 min). Jobs are saved to jobs.sqlite and persist across server restarts. Whether those jobs place real orders or paper ones depends entirely on the Money mode control — same schedule, either mode.

On a live trading day (Real mode):

  1. 09:45 — entry job fires. Spots are fetched, strikes selected, state file written, orders placed.
  2. 10:00 onwards — monitor fires at the configured interval. Fetches SC/SP prices, checks exit conditions. If no position is open yet, it retries entry instead (covers a transient miss like a broker blip) — except a Time Window filter, which always keeps retrying since it's designed to open later the same day.
  3. When an exit triggers, state becomes CLOSED. Subsequent monitor ticks return immediately without doing anything. The same happens the moment any other filter (VIX skip, Gap skip, Date window, Regime skip, ...) vetoes entry — that's treated as today's final no-trade decision, so monitor stops polling for the rest of the day instead of retrying every tick.

Stopping a strategy mid-week: Turn Automation off. If you plan to resume the same week, note that this removes the jobs rather than pausing them — turning it back on re-creates them from the current Config, which is equivalent for all practical purposes but does reset "next run" timing.

Viewing and Removing Jobs

The Scheduled Jobs panel on the Dashboard lists all active jobs with their next fire time and trigger. Click to remove any job.


Reports Page

Go to Reports (/reports) in the navigation bar to analyse historical trade event data.

Filters

Filter Description
Strategy Scope to a single strategy file (active or archived — archived ones are listed in their own group, suffixed "(archived)"), or leave blank for all
Status Only applies when Strategy is blank — scopes "all strategies" to Active (default), Archived, or All
Mode Filter by Paper or Real trades only
From / To Date range (defaults to the last 30 days). Dates are matched against the date field inside each event's payload

Picking a specific Strategy always shows its data regardless of the Status filter — Status only governs the "all strategies" aggregate. Archived strategies keep their full trade history here (unlike the Dashboard, which hides them entirely) — this is the place to review how a retired strategy actually performed.

Click Apply to reload all charts and the trade table. Click Reset to clear filters (Status resets to Active) and reload.

Summary Cards

Shown across the top row:

Card Description
Trading days Number of distinct days with at least one exit event
Total trades Exit events in the selected range
Win rate % of trades where P&L pts > 0
Net P&L (pts) Sum of all P&L points
Net P&L (₹) Sum of all P&L in rupees
Avg / trade Net P&L pts ÷ total trades
Best day Highest single-day P&L
Worst day Lowest single-day P&L
Max drawdown Largest consecutive run of negative days
Latency p50 (live) Median automation latency for live entries/exits — time from the strategy detecting a signal to the broker acknowledging the order. Shows "—" with no live trades in range
Latency p95 (live) 95th-percentile version of the same — the slow-tail case, not the typical one

Latency is measured only for real (live) trades, not paper — a paper order never round-trips to a broker, so there's nothing to time. Green means p95 is at or under the 200ms automation-latency target; red means it isn't.

Charts

Daily P&L (bar) — green bars for profitable days, red for losing days. The date range of the data is shown in the header.

Exit Breakdown (doughnut) — counts each distinct exit_type value across all trades. Useful for understanding how often the strategy exits via target vs. SL vs. EOD.

Cumulative P&L (line) — running sum of daily P&L points over time. Line colour reflects whether the period ended positive or negative.

Intraday P&L (line) — per-tick P&L path for a selected date, built from monitor events. Use the date dropdown (auto-set to the most recent date) to navigate between days. Hovering a point shows the call and put prices at that tick.

Trade Log Table

Each row represents one exit event paired with its entry data:

Column Description
Date Trade date
Strategy Strategy display name
Mode Paper / Real badge
Strikes CALL_STRIKEce / PUT_STRIKEpe
Premium Combined premium collected at entry
Expiry Expiry date of the short legs
Exit Exit type badge (colour-coded by outcome)
P&L pts Points P&L for this trade
P&L ₹ Rupees P&L for this trade
Retention P&L pts as % of premium collected (higher = better)

Performance Page

Go to Performance (/performance) in the navigation bar. Auto-refreshes every 30 seconds.

Use the Strategy filter at the top to scope all three sections to one strategy.

Summary Cards

One card per strategy × mode combination. Shows total closed trades, win rate, and cumulative P&L in both points and rupees.

Trade Events

A table of structured events emitted by strategies. Every significant action emits an event:

Event Emitted when
entry Trade entered at 09:45
skip Entry skipped (VIX/gap filter triggered)
short_exit Short legs closed (profit target / SL / hard exit)
exit Long legs closed (EOD DTE=1 exit) — final P&L event
fullday_complete End of a full-day simulation

Delete — click on any row to remove that event. Clear — click 🗑 Clear in the card header to delete all events for the selected strategy.

Run Logs

A table of every strategy subprocess execution. Each row shows:

  • Strategy name, timestamp, return code
  • View button — opens a scrollable modal with full stdout and stderr

Logs do not auto-refresh. Click ↻ Refresh Logs to reload manually.

Delete — click on any row. Clear — click 🗑 Clear in the card header.

Applies to ThetaPrime v0.35.4 · Page last updated 2026-08-22