Configuration reference
StopWarden reads one file: C:\ProgramData\StopWarden\autopilot.json (to use another path, set the environment variable AUTOPILOT_CONFIG). The installer copies config\autopilot.example.json there the first time and never overwrites it afterwards. After every edit, run autopilot doctor. It explains every mistake at once, in plain English.
Secrets are never in this file. Store them with:
autopilot store-secret nt8 # your NinjaTrader username + password
autopilot store-secret telegram # chat id + bot token
autopilot store-secret discord # webhook URL
They go into Windows Credential Manager (targets StopWarden/NinjaTrader, /Telegram, /Discord) and never leave your PC.
Times are HH:MM, 24-hour, on this PC's clock. Set Windows to your exchange's timezone (Settings → Time & language), or convert the times yourself.
nt8: how to reach NinjaTrader
| Key | Default | Meaning |
|---|---|---|
exe | C:\Program Files\NinjaTrader 8\bin\NinjaTrader.exe | Path to NinjaTrader 8. |
user_dir | "" = auto | Your NinjaTrader 8 data folder. Blank means <your Documents folder>\NinjaTrader 8, found through Windows so a Documents folder redirected to cloud storage still works. Set it only if doctor says it can't find it. |
login.method | "credential" | credential: types your stored NinjaTrader username/password into the login window. google: clicks your saved Google account (home PCs only; Google often blocks sign-ins from data-center/VPS IPs). none: you sign in yourself. |
login.google_account | "" | Required for google: text shown on the Google account tile, e.g. your email. |
connections | (required) | Connection names exactly as in NinjaTrader's Connections menu, e.g. ["My NinjaTrader"]. Tradovate-based prop accounts usually appear under My NinjaTrader. |
reject_feed_types | ["Simulated","Playback"] | Connections of these types are refused (so a replay or sim feed never drives a live account). |
targets: what to run (v1: exactly one)
"targets": [ { "strategy": "MyStrategy", "account": "Sim101", "instrument": "" } ]
| Key | Meaning |
|---|---|
strategy | The strategy name as shown in the Control Center → Strategies tab (the part before any /). |
account | The account column value on that row, exactly (e.g. Sim101, or your prop account id). |
instrument | Optional. The contract used for an emergency flatten if NT8 hasn't logged a position line yet, e.g. "NQ DEC26". Blank = take it from NinjaTrader's own position line (recommended). |
Using a trade copier? StopWarden protects only the one account you set up here: the leader. Follower accounts are not watched unless you list them in watchdog.watch_accounts (see the watchdog table below). A listed follower gets alerts only: StopWarden never closes its position, cancels its orders or places a stop on it.
Before first use: add the strategy to the Strategies tab yourself, on the right account and instrument, with the parameters you want, then save your workspace. StopWarden enables and disables that row; it never creates or edits strategies.
schedule: when
| Key | Default | Meaning |
|---|---|---|
days | Mon–Fri | Trading days (Mon Tue Wed Thu Fri Sat Sun). |
launch_at | 08:30 | Start NinjaTrader, sign in, connect. |
enable_at | 08:45 | Enable the strategy (only if flat). |
disable_at | 15:05 | Disable the strategy, then end-of-day cleanup. Must be after enable_at, same day. Keep it before 16:00 US Central (see below). |
flatten_on_disable | true | At disable_at: cancel working orders and flatten, then confirm flat from NT8's log. |
holidays | [] | Dates to skip entirely, "YYYY-MM-DD". |
early_closes | the example file lists 2026-11-27 and 2026-12-24 at 12:00 | Days CME closes early: {"YYYY-MM-DD": "HH:MM"}, the close time in US Central (CME's own clock, not this PC's). On a listed day StopWarden ends the day 10 minutes before the early close (11:50 Central for a 12:00 close), or at disable_at if that is earlier. Optional. |
Overnight/24h schedules aren't supported in v1. StopWarden enables within one day window.
Early closes. On a few days a year (the day after Thanksgiving, Christmas Eve) CME closes early, usually at 12:00 Central. A normal disable_at would then come after the market has closed, so the end-of-day close could not fill and the position would carry. List those days in early_closes, copied from CME's holiday calendar:
"early_closes": { "2026-11-27": "12:00", "2026-12-24": "12:00" }
A new install copies the dates from config\autopilot.example.json; an existing settings file keeps its own list, so after updating StopWarden copy any new dates across. autopilot doctor names an entry it ignores (Early closes: not a YYYY-MM-DD date, or not an HH:MM time) and warns when the listed dates end within 60 days (Early-close calendar).
All these times are on this PC's clock. CME stock-index futures stop trading every day from 16:00 to 17:00 US Central (the daily halt). A close sent during the halt cannot fill, so the end-of-day close would not happen. Keep disable_at before 16:00 Central, and before your prop firm's own "flat by" time if it has one. A new install sets disable_at to the local time that stays at or before 15:05 Central all year: 15:05 in Chicago, 16:05 in New York, 14:05 in Denver, 13:05 in Los Angeles, 20:05 in London (an hour earlier most of the year, because the UK changes clocks on different dates). autopilot doctor checks your disable_at in Central time for every day of the next year, so the weeks when the US and your country change clocks on different dates are caught: FAIL at 16:00 Central or later (the strategy would still run through the daily close), WARN from 15:55 Central. It names the dates and suggests a local time that is safe all year. StopWarden never changes the time you set.
East of about UTC+4 (Dubai, India, Tokyo, Sydney) 15:05 Central falls in the small hours of the next morning on this PC's clock, before enable_at, and the schedule is one same-day window (launch_at <= enable_at < disable_at). The installer then keeps disable_at at 15:05 and says so, and checks that the settings still load. Set the schedule by hand for your time zone: launch_at, enable_at and disable_at on the same day on this PC's clock, with disable_at before 15:55 Central every day. autopilot doctor gives the same advice in its End-of-day time row.
watchdog: naked-position backstop
| Key | Default | Meaning |
|---|---|---|
enabled | true | Run the watchdog. |
naked_seconds | fixed | How long a position may exceed its stop coverage before the watchdog acts. StopWarden fixes this wait; you do not choose it. A longer value in an older file is read as the fixed wait, with one warning in the log, and StopWarden still starts. A shorter value, or one that is not a number, is refused. In Watch, and in Protect until a Learn report is accepted, it only alerts. Protect turns on only for a strategy whose stop is normally working well inside that wait (the Learn report checks this: twice its slowest normal gap must fit inside the wait), so your strategy gets the first chance to replace a stop. The Learn report also adds up, for each minute, how long the position had no working stop, and refuses a strategy whose total, doubled, does not fit inside the wait in any one minute. |
poll_seconds | 1 | How often the NT8 log is checked, from 0.5 to 1 second. Any other value is refused: StopWarden must check at least once a second to act soon after its wait is over. |
flatten | true | false = alert only, never flatten, even in Protect. |
close_manual_positions | false | Only matters when protection.account_mode is "manual-allowed" (alerts only; nothing is closed there). A position you opened by hand (Chart Trader, SuperDOM, an order-entry window) with no stop then gets one WARN ("Manual position on ... has no stop. StopWarden doesn't close manual trades.") instead of the CRITICAL; true sends the CRITICAL for it too. On the default "algo" account every naked position is closed, hand-placed or not, and this setting has no effect (autopilot doctor WARNs when it is in your file there). StopWarden only treats a position as manual when NinjaTrader itself marks every fill that built it as hand-entered; if it can't tell, it treats the position as your strategy's and protects it. See SAFETY.md, "Positions you open by hand". |
watch_accounts | [] | Other accounts to alert on only, for example the follower accounts of a trade copier. List each name exactly as NinjaTrader shows it (for example ["APEX-12345-02", "APEX-12345-03"], up to 50). When one of them holds a position with no working stop for longer than StopWarden's wait, you get a CRITICAL alert naming that account. StopWarden never closes a position, cancels an order or places a stop there, in Watch or Protect. Your protected account doesn't belong here, and a name listed twice is ignored (each gets one warning in the log). |
extra_stop_name_prefixes | [] | Only if your strategy protects positions with orders that are not Stop Market/Stop Limit (for example a protective order your strategy logs under another order type): list their name prefixes (a list of text values, each at least 2 characters, for example ["SL_"]) and they'll count as protection. A Limit or Market-if-touched order is judged against your average entry price, not the market: on the profit side of it, or when the entry price is not known, it is a target and never counts, whatever its name; on the loss side of it, it counts. A Market order never counts through a name. |
How coverage is judged: per instrument, a position is covered when stop orders on the closing side (Sell for a long, Buy/Buy-to-cover for a short), on the same contract, add up to at least the position size. Profit targets never count, and neither does a stop that has partially filled (it has already gone to market). Which order states count is set by the protection section below.
The watchdog acts only with a running supervisor. It closes a position only when the supervisor has written a fresh Protect permission (state\tier.json, rewritten every ~15 s and trusted for at most 15 minutes), the supervisor is still running, and no kill switch (STOP) is set. A watchdog started on its own (autopilot watchdog, without the supervisor) is alert-only by design.
recovery: self-healing
| Key | Default | Meaning |
|---|---|---|
enabled | true | Relaunch / reconnect / re-enable when things break during the trading window. |
max_attempts_per_day | 6 | Hard cap per day. When it's hit: alert, stop trying, leave the strategy off. |
max_consecutive | 3 | Consecutive failures before switching to slow retry. |
backoff_minutes | 30 | Slow-retry interval. |
heartbeat_stale_minutes | 8 | Only used if your strategy writes the optional heartbeat file (see FAQ): no heartbeat for this long in the trading window → reconnect. |
ui_timeout_seconds | 240 | Longest any single NinjaTrader UI action may run before it's killed. |
alerts
| Key | Default | Meaning |
|---|---|---|
telegram | false | Send alerts to Telegram (store the secret first). |
discord | false | Send alerts to a Discord webhook. |
heartbeat_hours | 24 | Send a "still running" message every N hours (0 = off). It always goes to your phone, whatever phone_min_level says. StopWarden also sends one short summary a day after the market day (when it can read NinjaTrader's log), one message the first time your Learn report is complete, and, on a paid plan, one note on day 5 after you first start it. Those three reach your phone unless you set phone_min_level to "ERROR" or "CRITICAL". |
phone_min_level | "WARN" | The lowest level sent to Telegram/Discord: "INFO", "WARN", "ERROR" or "CRITICAL". Everything below it still goes to the log and the activity list in the StopWarden window. Problems (WARN and up) reach your phone. With "WARN" or "INFO", a few INFO messages reach it too: strategy enabled, all accounts flat at end of day, the daily summary, the Learn-complete message, the update notice and the day-5 note. Set "ERROR" or "CRITICAL" and those stay off your phone. Three always reach it, whatever this says: autopilot test-alert, the "still running" message, and a settings change that turns Protect off. |
heartbeat_url | "" (off) | If this PC turns off, restarts or crashes, StopWarden can't tell you. Set up a free outside check (for example healthchecks.io) and paste its ping address here. That service messages you when the pings stop. This is the only way to hear about a dead PC, since a dead PC can't send its own alert. How it works: while the supervisor is working, it opens that address (a plain GET) every 60 seconds with a 5-second timeout. If the PC, Windows or StopWarden dies, the pings stop and that service alerts you. Failures are ignored and never slow down the supervisor. A ping is skipped if no supervisor check has finished for 20 minutes, so a hung supervisor also stops the pings. Only https:// is accepted (no user:password@). StopWarden never contacts any address you didn't put here. |
If an alert can't be delivered (no internet, Telegram or Discord down), it isn't lost. StopWarden keeps up to 50 undelivered alerts in alerts_outbox.json in the state folder. When that is full, INFO alerts are dropped first. Each supervisor check (every 15 seconds) retries the ones that are due, waiting 30 s, 1 min, 2 min, 5 min, 10 min, then 15 min between tries. A late alert starts with [LATE: first raised <date time>, not delivered then] so you know when it really happened. The same alert is never sent twice within 10 minutes, and it only counts as sent once a channel has accepted it.
balance_floor: optional account guard
| Key | Default | Meaning |
|---|---|---|
enabled | false | Read the account balance from NinjaTrader's Accounts grid every 5 minutes. |
floor | 0 | If the balance is below this: alert, disable, flatten, and set the kill switch. For prop accounts, set it a little above your firm's liquidation level. |
accounts_tab | "Accounts" | Name of the Control Center tab that shows your accounts grid (if you renamed it). |
drawdown: prop-firm drawdown alerts (alert only)
Tells your phone how much of your firm's drawdown you have used, before you hit it. It only alerts. It never closes a position, cancels an order or disables a strategy because of drawdown.
"drawdown": {
"enabled": true,
"accounts": {
"Apex-123": { "start_balance": 50000, "max_drawdown": 2500, "mode": "trailing_intraday", "lock_at_start": true, "daily_loss_limit": 1000 }
}
}
| Key | Default | Meaning |
|---|---|---|
enabled | false | Turn drawdown alerts on. Off = nothing changes. |
accounts | {} | Your account name exactly as NinjaTrader shows it, and that account's rules from your firm's rules page. |
start_balance | required | The account's starting balance. |
max_drawdown | required | Your firm's drawdown limit in dollars (smaller than start_balance). |
mode | required | trailing_intraday: the limit follows every new high, including open profit. trailing_eod: it follows the balance at the end of each trading day (17:00 New York). static: it never moves (start_balance minus max_drawdown). |
lock_at_start | true | The trailing limit stops rising once it reaches start_balance (most firms do this). |
daily_loss_limit | not set | Optional. Your firm's daily loss limit in dollars, counted from the balance at the start of the trading day. |
high_water_mark | not set | Optional. Your firm's own high-water mark for the account, from its dashboard (at least start_balance). Set it whenever you switch this on part-way through an evaluation: without it, StopWarden can only start from the first balance it sees, and the room it shows may be too big. |
How it works:
- The balance is NinjaTrader's net liquidation for the account (or cash value plus open profit/loss when net liquidation is not reported). The StopWarden engine AddOn reads it on every plan, Watch included, whether or not the emergency-stop ladder is on: every 10 seconds while the ladder is off, every second while it runs. NinjaTrader must be open with the AddOn compiled. The account must also be one of your
targets: the AddOn reads balances only for target accounts (it takes its account list from the same setting that decides what it protects, and does not read this section). A drawdown account that matches no target gets a config warning, a WARN inautopilot doctor, and, while NinjaTrader is open, one alert a day: "No balance from NinjaTrader for <account> for 10 min: drawdown not tracked." Reading the balance never places, changes or cancels anything.autopilot doctorshows a Drawdown alerts line saying whether balances are arriving. - A balance read while NinjaTrader shows that account's connection as down may be an old, cached one. StopWarden does not use it: the levels do not move, and if it lasts more than 2 minutes with a position open you get the not-tracked WARN below.
- StopWarden keeps its own high-water mark in
state\drawdown_state.json. It starts atstart_balance, or at yourhigh_water_marksetting when you give one, or else at the first balance it sees if that is higher. When it had to start from the first balance (and that was not exactlystart_balance), you get one WARN, andautopilot doctorWARNs until you sethigh_water_mark: "Drawdown for <account>: I started tracking at $X. If your account was ever higher, set drawdown.accounts.<account>.high_water_mark to your firm's figure, or the room I show may be too big." trailing_eodtakes the balance at the 17:00 New York close. If StopWarden saw no balance in the 2 minutes before the close (PC asleep, NinjaTrader closed), it uses the first balance after the close instead (the market is shut until 18:00), and that same balance starts the new day's daily loss count. If the account was flat and its balance unchanged across the 17:00 New York roll (PC off, weekend), StopWarden uses the last balance it saw and sends no warning.- Alerts at 50%, 75% (WARN) and 90% (CRITICAL) of the room used, for example: "Apex-123: $1,875 of your $2,500 drawdown used (75%). Room left: $625. Floor: $48,125." Each level is sent once, and again only after the account recovers 10 points below it, or on the next trading day.
- If no fresh balance arrives for more than 2 minutes while a position is open, you get one WARN that the drawdown is not being tracked. Check the account in NinjaTrader yourself until it clears.
- Changing an account's
start_balanceormodestarts its tracking over. Changingmax_drawdownordaily_loss_limitkeeps the high-water mark. Adding or changinghigh_water_markuses your figure from then on (plus any higher balance StopWarden sees afterwards, or has seen as a real high).
paths
| Key | Default | Meaning |
|---|---|---|
state_dir | "" = C:\ProgramData\StopWarden\state | Logs, state, and the kill switch file STOP. |
supervisor: sleep and wake
| Key | Default | Meaning |
|---|---|---|
keep_awake | true | While the supervisor runs (Watch or Protect), it asks Windows not to go to sleep. It clears the request when it stops. The screen can still turn off. A lid close, the Sleep button or a company policy can still put the PC to sleep. false = let Windows sleep on its own power settings. |
A PC that sleeps watches nothing. If the time between two supervisor checks (normally 15 seconds) is more than 2 minutes longer than that, StopWarden sends one WARN when it wakes up: "StopWarden was paused for N minutes (PC sleep or freeze). Nothing was watched during that time." The alert also says whether a position is open now.
mode, telegram, license (schema 2)
| Key | Default | Meaning |
|---|---|---|
mode | "watch" | watch (the default for every install): detect and alert only, never act on the account. protect (opt-in): also launch, enable, re-enable, flatten and cancel as described in Safety. Protect needs all of: a paid licence, an accepted Learn report for the configured strategy and account (see protection below), and an algo account. The engine refuses to save mode: "protect" without an accepted report. A file edited by hand to protect without one stays alert-only: the supervisor and the watchdog both check the same gate. |
cancel_scope | "account" | How end of day, the kill switch, the balance floor and the enable-undo cancel orders. account: CLOSEPOSITION for the configured account's position (NinjaTrader cancels that instrument's working orders on that account with it) plus one ATI CANCEL per remaining working order on the configured account -- other accounts in the same NinjaTrader are never touched. global: additionally NinjaTrader's CANCELALLORDERS, which cancels working orders on every account; it is refused (with a WARN, falling back to account) whenever working orders have been seen on a non-configured account this session, and never sent in Watch mode. |
telegram.bot_username | "" | Your own bot's username, filled in by autopilot link-telegram. The bot token itself stays in Credential Manager. |
license.grace_days | 3 | Days a last-known-valid licence keeps working when the licence server can't be reached. Capped at 3: a larger value is treated as 3, a smaller one shortens the grace. |
A schema_version: 1 file is upgraded in memory on load (the three keys above get their defaults); nothing is lost.
protection: how cover is judged, and the Learn gate
| Key | Default | Meaning |
|---|---|---|
transition_max_s | 3.0 | A stop being moved (ChangePending / ChangeSubmitted) still counts as cover for this long, counted from the first change since the stop was last Working (0.1–3). |
arriving_max_s | 1.5 | A stop just sent (Submitted / Initialized) counts as cover for this long, counted from when it was sent, however many states it passes through (0.1–1.5). If it is then rejected, the credit is taken back: the naked time counts as if that stop had never been there. |
exit_settle_s | 3.0 | A closing Market order for the whole position counts as cover for this long from when it was sent: your strategy is exiting (0–3). A closing limit order is a resting target and never counts. |
naked_budget_s | 0 | Uncovered seconds within any rolling 60 s that also count as "too long", for a stop that keeps disappearing and coming back: 0, or from the wait up to 120. 0 = the same as the fixed watchdog.naked_seconds wait. A value lower than the wait is refused, because StopWarden could then close trades your strategy was about to protect. |
far_factor | 3.0 | A stop farther than far_factor × the max loss from your average entry still counts as cover, but you get a warning with the dollars at risk (1–20). |
max_loss_usd_per_contract | {} | Per instrument root, in dollars per contract, e.g. {"NQ": 800}. Built-in, in points: NQ 40, MNQ 40, ES 10, MES 10, YM 100, MYM 100, CL 0.50, GC 5. An instrument with neither gets no far-stop warning. |
reject_storm.count / reject_storm.minutes | 20 / 5 | A CRITICAL alert when this many orders are rejected on the account within this many minutes. |
account_mode | "algo" | "manual-allowed": you also trade this account by hand, so StopWarden never flattens or cancels on it by itself and the order guard stays off; alerts only. |
learn.min_trades / learn.min_sessions | 20 / 5 | When the Learn report counts as complete (round trips / trading sessions seen in NinjaTrader's log). |
learn.accepted | null | Written by autopilot learn --accept. Protect cannot act until it exists for the configured strategy and account. |
emergency_stop.enabled | false | The native emergency-stop ladder. Not part of this release. Leave it off: switched on, doctor FAILs it and it stays in shadow, because no compatible build is installed. |
emergency_stop.shadow | true | Shadow = the ladder would only log what it would do and never send an order. |
emergency_stop.rearm_s | not set | Seconds a position may sit without a working stop before the ladder places its own, within the range the settings check accepts. Not set = the value Learn accepted, else the built-in default. Takes effect only when the ladder is on and out of shadow, which this release does not allow. Set it with autopilot config-set --merge; the same key is what a window slider writes. |
Other states count as follows: a stop that NinjaTrader simulates on your PC (TriggerPending) counts only while the configured connection is up, and you are warned about it; a stop being cancelled counts only while an exit for the whole position is working.
Watch to Protect, step by step:
- Run in Watch (the default) while your strategy trades, until
autopilot learnsays the report is complete (20 round trips over 5 sessions by default). It reads NinjaTrader's log and changes nothing. - Read the report: how long your strategy's stop normally takes to be in place, how it moves it, and how many times Protect would have acted after its wait.
autopilot learn --accept. It refuses an incomplete report, and a strategy the report classifies as STOPLESS (exits without a resting stop), UNSTABLE (its slowest 1% of stop placements take longer than the wait), ATM, SLOW (strategies whose own stop takes too long to be working, or is missing for too long in total within a minute, judged against the wait) or two instruments held at once on one account: those stay Watch-only in this version.- Activate a paid licence, then set
modetoprotect(the StopWarden window's Use Protect, or this file). Until all of this is in place, Protect alerts after a short wait with no working stop and never flattens.