StopWarden is not open yet. Nothing here can be downloaded or bought today; these pages describe how StopWarden is planned to work when it opens. Get one email when it opens.
Troubleshooting
Start here every time:
autopilot doctor
autopilot status
doctor finds most setup problems and says how to fix each one. status shows the current phase, whether the strategy is on, positions, whether the kill switch is set, and today's counters (attempts, capped, blocked).
Where the logs live
Everything is in C:\ProgramData\StopWarden\state\ (or your paths.state_dir).
| File | What's in it |
|---|---|
autopilot.log | The supervisor and every autopilot command: schedule, each NinjaTrader action with its RESULT= token, every alert text. Rotates at 5 MB, keeps 5 (autopilot.log.1 ... .5). |
watchdog.log | The watchdog: start-up, NinjaTrader restarts, every naked-position decision and flatten. Same rotation. |
orderkill_events.log | One line per order-guard event (AddOn loaded, orders cancelled, cancel failed). These are forwarded as alerts. |
orderkill.log | The AddOn's detailed diagnostics. Rolls to .1 at 5 MB. |
supervisor_state.json | Today's counters: attempts, consecutive failures, backoff, capped, blocked, end-of-day done. |
watchdog_heartbeat.json | The watchdog's last check: time, and per account net, covered, naked, instrument. |
STOP | The kill switch. If it exists, nothing is enabled. |
login_rejected.flag | Present after NinjaTrader rejected the stored login. Sign-in won't type again until you re-store it. |
uia.lock | Short-lived lock so two screen actions never click at once. Goes stale on its own after 120 s. |
NinjaTrader's own log is in <Documents>\NinjaTrader 8\log\ (files log.YYYYMMDD.NNNNN.txt). StopWarden reads positions, orders, connections and strategy starts/stops from it.
The logs show each action's
RESULT=token. If aFAILEDresult below lists several possible reasons, check each one.
Doctor checks
| Check | Status | Cause | Fix |
|---|---|---|---|
Python version | FAIL | Python older than 3.10 is running StopWarden | Install 3.10+ (winget install -e --id Python.Python.3.12), open a new window. See also "autopilot is not recognized" below. |
Clock / timezone | always PASS | Informational | Check that the time and timezone shown are the ones your schedule is written in. |
Config | FAIL | config not found, not valid JSON, or a list of config problems | Fix every listed line. Configuration explains each setting. JSON tip: no trailing commas; backslashes in paths are doubled (\\). |
NT8 program | FAIL | nt8.exe path is wrong | Set nt8.exe to your NinjaTrader.exe. |
NT8 user folder | FAIL | Your NinjaTrader 8 data folder wasn't found | Set nt8.user_dir to it (usually <Documents>\NinjaTrader 8). |
NT8 log folder | FAIL | <user folder>\log is missing | Start NinjaTrader once. Check nt8.user_dir. |
NT8 newest log | WARN | No log yet, or the newest is over an hour old | Normal when NinjaTrader isn't running. Otherwise check nt8.user_dir. |
Cancel orders on disable | FAIL | NinjaTrader's cancel-on-disable settings aren't both on in Config.xml | Tools > Options > Strategies > NinjaScript: tick Cancel entry orders when a strategy is disabled and Cancel exit orders when a strategy is disabled, OK. If doctor still fails, close NinjaTrader normally so it saves its settings, and re-run. |
Cancel on disable (strategy row) | FAIL | Your strategy row is running with one of those options off, even though the settings are now on. NinjaTrader copies the two options into a row when the row is added, and prints the row's own values in its "Enabling NinjaScript strategy" log line. | Remove the strategy from the Strategies tab and add it again (with both options on). Then autopilot resume. WARN here just means the row has not started in this NinjaTrader session yet; it is checked after every enable. |
ATI (for emergency flatten) | WARN | AT Interface is off (or its setting wasn't found) | Tools > Options > Automated trading interface > tick AT Interface, OK. Without it, flattening uses slower screen clicks. |
Connections | FAIL | A connection name contains Simulated or Playback | Use a live data connection (e.g. My NinjaTrader) and trade Sim101 on it. |
Target | PASS | Shows the strategy and account StopWarden will manage | Check the spelling against the Strategies tab. |
NinjaTrader login stored | FAIL | login.method is credential but nothing is stored | autopilot store-secret nt8 |
Telegram alert secret / Discord alert secret | FAIL | That channel is on in alerts but its secret isn't stored | autopilot store-secret telegram / autopilot store-secret discord |
Alerts | WARN | No alert channel is on | Turn on alerts.telegram and/or alerts.discord. Without alerts you won't hear about problems. |
State folder writable | FAIL | Your user can't write to the state folder | Re-run install.ps1 as Administrator (it sets the folder permissions), or fix paths.state_dir. |
Kill switch | WARN | STOP exists | Deliberate? Leave it. Ready to trade? autopilot resume. |
Order-guard AddOn | WARN | The AddOn file isn't in bin\Custom\AddOns | Re-run install.ps1 (answer y), then compile with F5 in the NinjaScript Editor. |
Order-guard config | WARN | orderkill.json is missing or switched off | Normal before StopWarden's first start. It is written when the supervisor starts (autopilot ensure-running). |
Scheduled task | WARN | StopWarden Supervisor or StopWarden Keepalive is missing | autopilot install-tasks (normal window, as the user who runs NinjaTrader). |
Strategy row (--ui only) | WARN | NinjaTrader isn't open and signed in | Open and sign in, run autopilot doctor --ui again. |
Strategy row (--ui only) | FAIL NOTFOUND | No row matches the strategy and account | Add it in the Strategies tab (QUICKSTART Step 2), or fix the spelling in targets. Both must match exactly, including case. |
Strategy row (--ui only) | FAIL AMBIGUOUS | Two or more rows match | Remove the duplicate rows, save the workspace. |
Strategy row (--ui only) | FAIL FAILED | The row couldn't be read | See FAILED under nt8_strategy below. |
Alerts and states
CRITICAL BLOCKED for today at <step> (<RESULT>). <fix>. Then run: autopilot resume
Cause: a problem that retrying can't fix (see the RESULT tables below). StopWarden stops trying until you act. Fix: do what the alert says, run autopilot doctor, then autopilot resume. A running supervisor clears the block on its next tick (within ~15 s); no restart needed.
CRITICAL Recovery CAP hit (N attempts today, last: <step> <RESULT>) ...
Cause: recovery.max_attempts_per_day (default 6) recovery attempts used up today. The strategy is off for the rest of the day. If a position was open, it was left alone and the alert says Hands needed. Fix:
- Look at
autopilot.logfor the repeated failure (search forRESULT=). - Fix the cause.
- Run
autopilot resumeto reset today's counters. A running supervisor picks it up within ~15 s. - StopWarden then re-enables if it's still inside the trading window and the account is flat.
CRITICAL Recovery CAP hit: StopWarden closed an unprotected position on <account> and turned <strategy> back on 3 times today ...
Cause: three times today the watchdog closed a position that had no working stop, and StopWarden turned the strategy back on each time. A strategy whose positions keep losing their stop needs a look before it trades again, so StopWarden leaves it off for the rest of the day. Fix:
- Look in
autopilot.logforNAKEDlines, and in NinjaTrader's log for what happened to the stop just before. - Fix the cause in the strategy or its settings.
- Run
autopilot resume. A running supervisor picks it up within ~15 s.
WARN <step> failed N times in a row (...). Backing off 30 min ...
Cause: max_consecutive failures in a row. Fix: nothing, if it recovers. If it keeps failing, find the failing RESULT= in autopilot.log.
CRITICAL KILL SWITCH (STOP file) is set: ... / CRITICAL Stopped by command: ...
Cause: someone ran autopilot stop, created a STOP file, or the balance floor fired. Nothing is enabled until you resume. The alert lists what was done (disable result, cancel-all, flatten). Fix: when you're ready, autopilot resume. To check whether it's set: autopilot status ("kill_switch": true) or autopilot doctor (Kill switch line).
REFUSED: <account> holds <qty> <instrument> ...; disabling the strategy will cancel its stop ...
Cause: you ran autopilot stop with a position open, and this stop would not close it (Watch mode, or flatten_on_disable: false). NinjaTrader's cancel-on-disable would cancel the strategy's stop and leave the position unprotected, so nothing was done. Fix: autopilot stop --flatten to close the position too, or autopilot stop --leave-open if you will manage it by hand.
CRITICAL UNPROTECTED under STOP: ...
Cause: the kill switch is set and a position on the account has no stop (its stop was cancelled with the disable). Under STOP the watchdog never flattens. The alert repeats every 5 minutes until the account is flat. Fix: close the position by hand now, or run autopilot stop --flatten.
CRITICAL BALANCE FLOOR: <account> balance X < floor Y. ...
Cause: the Accounts grid showed a balance below balance_floor.floor. The strategy was disabled, STOP was set, and orders were cancelled and the position closed (the balance floor always flattens). Fix: check the account at your broker. Decide whether to keep trading. Then autopilot resume.
WARN Windows desktop is LOCKED: UI actions ... are paused
Cause: the screen is locked, or there is no interactive desktop. Fix: unlock it. Set Windows to never lock during trading hours.
CRITICAL Naked position flattened via OIF|UIA. ...
Cause: the position wasn't covered by working stops for longer than the wait, or for that long in total within one minute. Check watchdog.log and NinjaTrader's Orders tab to see why the stop disappeared (rejected change, strategy error, manual cancel). If the watchdog flattens healthy trades:
- Your strategy may protect positions with orders that aren't
Stop Market/Stop Limit. List their name prefixes inwatchdog.extra_stop_name_prefixes(a list of text values, each at least 2 characters, for example["SL_"]). A profit target named with one of them still does not count as a stop. - Your strategy's stops may sit in
Trigger pending, which can mean NinjaTrader holds them on this PC. StopWarden counts such a stop only while the connection named innt8.connectionsis seen up in NinjaTrader's log. Copy the name exactly.autopilot doctorfails its "Connection seen" check when the name does not match and such stops were seen,autopilot learnsays so in its summary, and Protect stays closed until the name matches. - Your strategy may take longer than the wait to place its stop after entry. StopWarden does not wait longer than that. Run
autopilot learn: a strategy whose stop is not reliably working well inside the wait is mode SLOW, and Protect stays off for it (Watch keeps alerting). - Your strategy may cancel and re-place its stop many times a minute, so the short gaps add up to the wait. The Learn report checks this too: a total that is too long in any one minute is also mode SLOW.
- You may be trading the account by hand without a stop. Don't do that on the configured account (see Safety).
CRITICAL NAKED POSITION, flatten did NOT clear it (STILL_BAD:<RESULT>) / ... 3 flatten attempts failed -- hands needed now
Cause: neither ATI nor the screen-click fallback cleared the position. Fix: flatten it yourself, now, in NinjaTrader or at your broker. Then check that AT Interface is on and the desktop is unlocked. <RESULT> is the fallback's token (see nt8_flatten below).
CRITICAL NAKED POSITION (watchdog.flatten is off, NOT flattening)
watchdog.flatten is false, so this is alert-only. Act yourself.
WARN Protect is on but cannot act yet: <reason>. Until then StopWarden only alerts, after the wait with no working stop.
Cause: mode is protect and the licence is active, but the Protect gate is closed for the reason shown, most often Learn report not accepted yet. Until it opens, nothing is closed or cancelled: naked positions get an alert only. autopilot doctor shows the same reason on its Protect gate line. Fix: run autopilot learn; once the report is complete, read it and run autopilot learn --accept. If the reason is a Watch-only strategy mode (STOPLESS, UNSTABLE, ATM, or SLOW: strategies whose own stop is not reliably working well inside the wait) or two instruments on one account, Protect stays off for this setup in this version. See Safety.
A naked-position alert with no flatten also happens, by design, when the watchdog runs without the supervisor (autopilot watchdog started by hand) or while the kill switch (STOP) is set.
CRITICAL Order guard: ...
The AddOn cancelled working orders on your account while no strategy was running (or a cancel failed). Expected after a strategy stops with orders left behind. If you placed those orders by hand, see SAFETY section 4: manual orders on the configured account are cancelled whenever no strategy is running.
CRITICAL END OF DAY PROBLEM: ...
Cause: the disable failed, and/or an account still shows a position after cancel + flatten. Fix: check NinjaTrader and your broker now. Disable the strategy by hand if it's still on. Flatten by hand if needed.
CRITICAL END OF DAY: NT8 is NOT running ... CHECK YOUR BROKER NOW
Cause: NinjaTrader was closed or had crashed at disable_at. Orders already at the broker can still fill. Fix: log in to your broker (or open NinjaTrader) and check for open positions and working orders.
WARN Watchdog (pid N) heartbeat is stale (...): restarting it. / CRITICAL Could not start the watchdog
The supervisor restarts a watchdog that stopped writing its heartbeat. If it can't start, check that Python works (autopilot version) and see watchdog.log.
ERROR Supervisor error (continuing): ...
An unexpected error in one supervisor tick. It keeps running. If it repeats, send a support bundle.
The strategy wasn't enabled this morning
Check autopilot status and search autopilot.log for enable not attempted:.
| Verdict in the log | Meaning | Fix |
|---|---|---|
REFUSED_KILL_SWITCH | STOP is set | autopilot resume |
REFUSED_NOT_FLAT | The log shows a position on the account | Flatten it. StopWarden enables once flat. |
REFUSED_REJECTED_FEED | A connection name contains Simulated/Playback | Fix nt8.connections |
REFUSED_WATCHDOG_NOT_COVERING (WAIT_WATCHDOG) | The watchdog heartbeat is older than 30 s | Usually clears in a minute. If not, see watchdog.log. |
Also check: is today in schedule.days and not in holidays? Is the PC clock right? Is the desktop unlocked? Is the day blocked or capped in status?
RESULT tokens
These appear in autopilot.log (ps <script> -> RESULT=<TOKEN>) and in some alerts.
Any script
| Token | Meaning | Fix |
|---|---|---|
TIMEOUT | The step hit recovery.ui_timeout_seconds and was killed | Usually a pop-up or modal covering NinjaTrader. Look at the screen. Close unexpected dialogs. |
MISSING_SCRIPT | A file in ps\ is missing (blocks the day) | Re-run install.ps1. |
ERROR / NO_RESULT | PowerShell couldn't start, or the script printed no result | Check Windows PowerShell 5.1 works. Send a support bundle. |
Sign-in (nt8_launch_login.ps1)
| Token | Meaning | Fix |
|---|---|---|
LOGIN_REJECTED | NinjaTrader rejected the stored username/password. Latched: StopWarden won't type it again. Blocks the day. | Check the login by hand, then autopilot store-secret nt8 (this clears the latch), then autopilot resume. |
NO_CREDENTIAL | No NinjaTrader login stored (blocks the day) | autopilot store-secret nt8, then autopilot resume. Store it as the same Windows user that runs StopWarden. |
NOT_INSTALLED | nt8.exe not found (blocks the day) | Fix nt8.exe. |
TIMEOUT | The Control Center didn't appear in time | NinjaTrader slow to start, an update prompt, or a Google page waiting. Look at the screen. |
FAILED | Couldn't proceed safely: not an interactive, unlocked, active desktop session; login form not usable; focus lost while typing; a different program at the login window; NinjaTrader exited; bad parameters | Unlock the desktop, reconnect Remote Desktop, close windows covering the login, check nt8.exe points to the NinjaTrader you run. |
With google, repeated TIMEOUT or FAILED usually means Google showed a page StopWarden won't click (a new device check, a captcha). Sign in by hand, or switch to credential or none.
Connect (nt8_connect.ps1, nt8_disconnect.ps1)
| Token | Meaning | Fix |
|---|---|---|
NOT_FOUND | No connection with that exact name in the Connections menu (blocks the day) | Copy the name exactly into nt8.connections, then autopilot resume. |
FAILED | Clicked, but the log never showed Connected, or the menu couldn't be opened | Broker/internet down, wrong credentials inside the connection, or a pop-up in the way. Try connecting by hand. |
FAILED (disconnect) | NinjaTrader asked "really disconnect?" with orders active and StopWarden answered No, because a position was open | Expected. StopWarden doesn't force a disconnect with a position on. |
Strategy (nt8_strategy.ps1)
| Token | Meaning | Fix |
|---|---|---|
HYGIENE_OFF | Cancel-on-disable settings not both on, or Config.xml not found (blocks the day) | See the Cancel orders on disable doctor check. Then autopilot resume. |
HYGIENE_OFF_INSTANCE | The strategy row itself runs with a cancel-on-disable option off (NinjaTrader's own Enabling line says so). If it was our enable, StopWarden disabled it again and cancelled its orders at once (blocks the day) | See the Cancel on disable (strategy row) doctor check: remove the row and add it again. Then autopilot resume. |
NOTFOUND | No Strategies-tab row matches strategy and account (blocks the day) | Add the row, or fix the spelling (exact, case-sensitive). Save the workspace. autopilot resume. |
AMBIGUOUS | More than one row matches (blocks the day) | Delete the duplicates, save the workspace, autopilot resume. |
NOT_CONFIRMED_FLAT | The account wasn't confirmed flat | Flatten. Doesn't use up an attempt. |
DIED_AT_STARTUP | Enable was clicked, but within 75 s the strategy disabled itself, never logged a start, or the box turned OFF | Your strategy is failing to start. Open NinjaTrader's Log tab for its error (data loading, a parameter, an exception). Test by enabling it by hand. |
FAILED | Possible causes: kill switch present; NinjaTrader not running; no Control Center; another screen action held the lock too long; the enable box was covered by another window; the box didn't stay ON (NinjaTrader drops an enable when no live data connection is up); the box state couldn't be read | Check connections are live, nothing covers the Control Center, the desktop is unlocked. |
ALREADY_ON / ALREADY_OFF | Nothing to do | — |
Flatten fallback (nt8_flatten.ps1)
| Token | Meaning | Fix |
|---|---|---|
FLATTEN_CLICKED | Close Position was clicked. StopWarden then checks the log. | — |
NO_POSITION_ROW | No matching row in the Positions tab | Flat already, or the instrument name differs. Check at your broker. |
FAILED | Couldn't click it | Flatten by hand. Turn AT Interface on so the fast path works. |
Balance (nt8_read_balance.ps1)
| Token | Meaning | Fix |
|---|---|---|
NOT_FOUND | Accounts grid shows other accounts but not yours | Check the account name. |
UNREADABLE | Tab, grid or balance column not found | Set balance_floor.accounts_tab to your tab's name. Make sure the grid has a Net liquidation or Cash value column. |
A failed balance read is only logged (balance read for ...). It doesn't stop trading, and it doesn't alert.
Install problems
| Symptom | Fix |
|---|---|
Installer exit 3 / "Run this from an elevated PowerShell" | Right-click Windows PowerShell > Run as administrator. |
Installer exit 2 / "Python 3.10 or newer was not found" | winget install -e --id Python.Python.3.12, open a new window, run the installer again. |
NinjaTrader AddOns folder not found | Start NinjaTrader once, or pass -Nt8UserDir "<your NinjaTrader 8 folder>". |
Another file also defines StopWardenOrderGuard | Delete the other file it names, then F5. |
| AddOn compile errors after F5 | Compile errors in other NinjaScript files also block the compile. Fix or remove those files. |
'autopilot' is not recognized | Open a new PowerShell window after installing (PATH changed). Still failing? autopilot tries, in order: the environment variable AUTOPILOT_PYTHON (full path to python.exe), python on PATH, then the py -3 launcher. Set AUTOPILOT_PYTHON if none of those works. |
install-tasks: task command is N chars (schtasks limit 261) | Re-install to a shorter folder with -InstallDir, e.g. C:\StopWarden. |
store-secret says not stored | Entries were empty, didn't match, or contained unsupported characters. Try again. |
Sending a support bundle
Send:
- The full text output of
autopilot doctorandautopilot status. - From
C:\ProgramData\StopWarden\state\:autopilot.log,watchdog.log,orderkill_events.log,orderkill.log,supervisor_state.json,watchdog_heartbeat.json(plusautopilot.log.1if the problem was earlier today). C:\ProgramData\StopWarden\autopilot.json. It contains no secrets.- If asked: that day's NinjaTrader log,
<Documents>\NinjaTrader 8\log\log.YYYYMMDD.NNNNN.txt. autopilot version, and your NinjaTrader version (Help > About).
These files contain your account name, strategy name, positions and order details. If you use Google sign-in, autopilot.log also contains the Google account text from your config. Replace anything you don't want to share before sending.
Never send passwords, your Telegram bot token, your Discord webhook URL, or screenshots of Windows Credential Manager. StopWarden doesn't write these to its logs, and support will never ask for them.