StopWarden

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).

FileWhat's in it
autopilot.logThe 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.logThe watchdog: start-up, NinjaTrader restarts, every naked-position decision and flatten. Same rotation.
orderkill_events.logOne line per order-guard event (AddOn loaded, orders cancelled, cancel failed). These are forwarded as alerts.
orderkill.logThe AddOn's detailed diagnostics. Rolls to .1 at 5 MB.
supervisor_state.jsonToday's counters: attempts, consecutive failures, backoff, capped, blocked, end-of-day done.
watchdog_heartbeat.jsonThe watchdog's last check: time, and per account net, covered, naked, instrument.
STOPThe kill switch. If it exists, nothing is enabled.
login_rejected.flagPresent after NinjaTrader rejected the stored login. Sign-in won't type again until you re-store it.
uia.lockShort-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 a FAILED result below lists several possible reasons, check each one.


Doctor checks

CheckStatusCauseFix
Python versionFAILPython older than 3.10 is running StopWardenInstall 3.10+ (winget install -e --id Python.Python.3.12), open a new window. See also "autopilot is not recognized" below.
Clock / timezonealways PASSInformationalCheck that the time and timezone shown are the ones your schedule is written in.
ConfigFAILconfig not found, not valid JSON, or a list of config problemsFix every listed line. Configuration explains each setting. JSON tip: no trailing commas; backslashes in paths are doubled (\\).
NT8 programFAILnt8.exe path is wrongSet nt8.exe to your NinjaTrader.exe.
NT8 user folderFAILYour NinjaTrader 8 data folder wasn't foundSet nt8.user_dir to it (usually <Documents>\NinjaTrader 8).
NT8 log folderFAIL<user folder>\log is missingStart NinjaTrader once. Check nt8.user_dir.
NT8 newest logWARNNo log yet, or the newest is over an hour oldNormal when NinjaTrader isn't running. Otherwise check nt8.user_dir.
Cancel orders on disableFAILNinjaTrader's cancel-on-disable settings aren't both on in Config.xmlTools > 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)FAILYour 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)WARNAT 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.
ConnectionsFAILA connection name contains Simulated or PlaybackUse a live data connection (e.g. My NinjaTrader) and trade Sim101 on it.
TargetPASSShows the strategy and account StopWarden will manageCheck the spelling against the Strategies tab.
NinjaTrader login storedFAILlogin.method is credential but nothing is storedautopilot store-secret nt8
Telegram alert secret / Discord alert secretFAILThat channel is on in alerts but its secret isn't storedautopilot store-secret telegram / autopilot store-secret discord
AlertsWARNNo alert channel is onTurn on alerts.telegram and/or alerts.discord. Without alerts you won't hear about problems.
State folder writableFAILYour user can't write to the state folderRe-run install.ps1 as Administrator (it sets the folder permissions), or fix paths.state_dir.
Kill switchWARNSTOP existsDeliberate? Leave it. Ready to trade? autopilot resume.
Order-guard AddOnWARNThe AddOn file isn't in bin\Custom\AddOnsRe-run install.ps1 (answer y), then compile with F5 in the NinjaScript Editor.
Order-guard configWARNorderkill.json is missing or switched offNormal before StopWarden's first start. It is written when the supervisor starts (autopilot ensure-running).
Scheduled taskWARNStopWarden Supervisor or StopWarden Keepalive is missingautopilot install-tasks (normal window, as the user who runs NinjaTrader).
Strategy row (--ui only)WARNNinjaTrader isn't open and signed inOpen and sign in, run autopilot doctor --ui again.
Strategy row (--ui only)FAIL NOTFOUNDNo row matches the strategy and accountAdd 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 AMBIGUOUSTwo or more rows matchRemove the duplicate rows, save the workspace.
Strategy row (--ui only)FAIL FAILEDThe row couldn't be readSee 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:

  1. Look at autopilot.log for the repeated failure (search for RESULT=).
  2. Fix the cause.
  3. Run autopilot resume to reset today's counters. A running supervisor picks it up within ~15 s.
  4. 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:

  1. Look in autopilot.log for NAKED lines, and in NinjaTrader's log for what happened to the stop just before.
  2. Fix the cause in the strategy or its settings.
  3. 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 in watchdog.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 in nt8.connections is seen up in NinjaTrader's log. Copy the name exactly. autopilot doctor fails its "Connection seen" check when the name does not match and such stops were seen, autopilot learn says 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 logMeaningFix
REFUSED_KILL_SWITCHSTOP is setautopilot resume
REFUSED_NOT_FLATThe log shows a position on the accountFlatten it. StopWarden enables once flat.
REFUSED_REJECTED_FEEDA connection name contains Simulated/PlaybackFix nt8.connections
REFUSED_WATCHDOG_NOT_COVERING (WAIT_WATCHDOG)The watchdog heartbeat is older than 30 sUsually 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

TokenMeaningFix
TIMEOUTThe step hit recovery.ui_timeout_seconds and was killedUsually a pop-up or modal covering NinjaTrader. Look at the screen. Close unexpected dialogs.
MISSING_SCRIPTA file in ps\ is missing (blocks the day)Re-run install.ps1.
ERROR / NO_RESULTPowerShell couldn't start, or the script printed no resultCheck Windows PowerShell 5.1 works. Send a support bundle.

Sign-in (nt8_launch_login.ps1)

TokenMeaningFix
LOGIN_REJECTEDNinjaTrader 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_CREDENTIALNo NinjaTrader login stored (blocks the day)autopilot store-secret nt8, then autopilot resume. Store it as the same Windows user that runs StopWarden.
NOT_INSTALLEDnt8.exe not found (blocks the day)Fix nt8.exe.
TIMEOUTThe Control Center didn't appear in timeNinjaTrader slow to start, an update prompt, or a Google page waiting. Look at the screen.
FAILEDCouldn'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 parametersUnlock 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)

TokenMeaningFix
NOT_FOUNDNo connection with that exact name in the Connections menu (blocks the day)Copy the name exactly into nt8.connections, then autopilot resume.
FAILEDClicked, but the log never showed Connected, or the menu couldn't be openedBroker/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 openExpected. StopWarden doesn't force a disconnect with a position on.

Strategy (nt8_strategy.ps1)

TokenMeaningFix
HYGIENE_OFFCancel-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_INSTANCEThe 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.
NOTFOUNDNo 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.
AMBIGUOUSMore than one row matches (blocks the day)Delete the duplicates, save the workspace, autopilot resume.
NOT_CONFIRMED_FLATThe account wasn't confirmed flatFlatten. Doesn't use up an attempt.
DIED_AT_STARTUPEnable was clicked, but within 75 s the strategy disabled itself, never logged a start, or the box turned OFFYour 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.
FAILEDPossible 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 readCheck connections are live, nothing covers the Control Center, the desktop is unlocked.
ALREADY_ON / ALREADY_OFFNothing to do—

Flatten fallback (nt8_flatten.ps1)

TokenMeaningFix
FLATTEN_CLICKEDClose Position was clicked. StopWarden then checks the log.—
NO_POSITION_ROWNo matching row in the Positions tabFlat already, or the instrument name differs. Check at your broker.
FAILEDCouldn't click itFlatten by hand. Turn AT Interface on so the fast path works.

Balance (nt8_read_balance.ps1)

TokenMeaningFix
NOT_FOUNDAccounts grid shows other accounts but not yoursCheck the account name.
UNREADABLETab, grid or balance column not foundSet 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

SymptomFix
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 foundStart NinjaTrader once, or pass -Nt8UserDir "<your NinjaTrader 8 folder>".
Another file also defines StopWardenOrderGuardDelete the other file it names, then F5.
AddOn compile errors after F5Compile errors in other NinjaScript files also block the compile. Fix or remove those files.
'autopilot' is not recognizedOpen 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 storedEntries were empty, didn't match, or contained unsupported characters. Try again.

Sending a support bundle

Send:

  1. The full text output of autopilot doctor and autopilot status.
  2. From C:\ProgramData\StopWarden\state\: autopilot.log, watchdog.log, orderkill_events.log, orderkill.log, supervisor_state.json, watchdog_heartbeat.json (plus autopilot.log.1 if the problem was earlier today).
  3. C:\ProgramData\StopWarden\autopilot.json. It contains no secrets.
  4. If asked: that day's NinjaTrader log, <Documents>\NinjaTrader 8\log\log.YYYYMMDD.NNNNN.txt.
  5. 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.