December 2, 2026
Most surprises with a NinjaTrader 8 trading bot come from one mismatch: the strategy's own virtual position is not the same thing as the position in your account. When you enable a NinjaScript strategy, NinjaTrader first runs it over the historical bars on the chart and gives it the position it would hold. If that position doesn't match your real account and you haven't chosen a start behavior that handles it, the strategy's next exit can open a new, unintended live position. Before you enable automation on a live account, check four settings: Start behavior (default: Wait until flat), connection loss handling (default: Recalculate, after a 10-second disconnect delay), real-time error handling (default: stop, cancel orders and close the position on a rejected order) and Exit on session close (default: on).
This guide explains what each of those settings does, based on NinjaTrader's current NinjaScript and Help Guide documentation, and turns it into a pre-live checklist. It's written for futures traders running their own strategy or a purchased NinjaScript strategy. It is documentation research, not a hands-on test: we did not run these settings on a live account and make no claims about fills, speed or profitability. If you are still choosing a platform, start with our futures trading bot comparison.

In NinjaTrader 8, an automated strategy is a NinjaScript strategy: C# code you write yourself, code generated by Strategy Builder (its guided step-by-step builder or the newer AI Strategy Builder, both of which produce NinjaScript), or a third-party package you import. You run it by opening the Strategies window from a chart (or adding it in the Control Center's Strategies tab), choosing the account and data series, setting its properties and setting Enabled to true. NinjaTrader's documentation is blunt about what that means: a running strategy is a self-contained automated trading system, and the orders it generates are live.
Two details catch new users out:
NinjaTrader tracks two positions:
You normally want them to match. NinjaTrader lists the common reasons they don't: running more than one strategy on the same market, trading the same market manually from the SuperDOM or Chart Trader, and starting a strategy partway through a session.
The documentation's own example is worth walking through. You enable a strategy an hour after the session opens. During that historical hour, the strategy would have bought one contract and still be holding it, so its strategy position is long 1. But no real order was ever placed, so the account is flat. If nothing reconciles the two, the strategy's next exit, a sell of one contract, takes the strategy position to flat and leaves the account short one contract. That's a real, unplanned position created by a correctly coded strategy.
Two places show you whether you're in sync. In the Control Center's Strategies tab, the Position column is the strategy position, Acct. position is the account position (including positions the strategy didn't enter), and the Sync column shows true when they match. The strategy name's color shows its state: green is running, orange is waiting to reach flat so it can sync, and black is disabled.
The Start behavior property decides what happens to that mismatch when the strategy is enabled. In code it's the StartBehavior property, and the default is WaitUntilFlat. Every option first deals with active orders the strategy previously generated on the account; if NinjaTrader can't cancel those and get confirmation within 40 seconds, the strategy doesn't start and NinjaTrader raises an alert.
| Start behavior | What it assumes | Can NinjaTrader send its own market order? | When strategy orders go live | Fits when |
|---|---|---|---|---|
| Wait until flat (default) | The account is flat | No | Once the strategy position reaches or crosses flat; until then trades are virtual | Your account really is flat in that instrument and no one else trades it |
| Wait until flat, synchronize account | You want to start from flat | Yes: market order(s) to flatten the account if it isn't flat | Once the strategy position reaches or crosses flat | You want NinjaTrader to clear a leftover position and then start cleanly |
| Immediately submit | The account already matches the strategy position | No | Immediately; it maps matching working orders and submits the rest | You've manually set the account to the strategy position, such as after a planned restart |
| Immediately submit, synchronize account | The strategy position is correct | Yes: market order(s) so the account matches the strategy position | Immediately | You accept that NinjaTrader may trade at market on start to match the strategy |
| Adopt account position | The real account position is correct | No reconciliation to the historical position; the strategy starts from the account's position | Immediately | Only for strategies coded with IsAdoptAccountPositionAware; one such strategy per account and instrument at a time |
A few documented caveats change how you should read that table:
OnOrderUpdate() and OnExecution() methods can't manage it.IsAdoptAccountPositionAware to true. If you don't see it on a purchased strategy, the vendor didn't program it to handle real account positions.There's also a Synchronize All Strategies command in the Strategies tab. It adds up the strategy positions of all enabled strategies that are not set to Wait until flat for each account and instrument, compares the total to the account and sends a market order for any difference. In NinjaTrader's example, two strategies each long 1 on a flat account produce a market order to buy 2 contracts. Treat it as a trade, not a refresh button.
There's no universally right answer, but the documentation supports a simple decision path:
Whatever you choose, check the Strategies tab's Sync column immediately after enabling, and again after any manual action on that account.
Connection loss handling is set by the ConnectionLossHandling property, with the disconnect threshold in DisconnectDelaySeconds (default 10 seconds).
| Option | Documented behavior |
|---|---|
| Recalculate (default) | If the strategy was stopped by the disconnect, it tries to recalculate its strategy position when the connection is re-established. If the connection returns before the strategy was stopped, it keeps running as if nothing happened. |
| Keep running | The strategy keeps running and resumes as if no disconnect occurred. |
| Stop strategy | The strategy stops after a disconnect longer than the delay; nothing happens when the connection returns. |
Under the default, NinjaTrader stops the strategy when the data feed is down for longer than the delay, when the order feed is down and the strategy tries an order action during the outage, or when both feeds are down for longer than the delay. Note what isn't promised: none of these modes describes closing your open account position for you. If your bot can be stopped mid-trade, decide in advance whether working stop orders at the broker should protect the position, and how you'll be alerted. Our guide to monitoring a live trading bot covers alerting, and our VPS hosting guide covers keeping a desktop platform online.
The RealtimeErrorHandling property controls what a strategy does when the broker returns one of its orders as rejected. By default (StopCancelClose), the strategy stops, cancels its remaining working orders and closes the positions it manages with a Close order for each position. StopCancelCloseIgnoreRejects keeps that behavior for other errors but not for rejections, and IgnoreAllErrors ignores order errors and keeps running.
NinjaTrader flags IgnoreAllErrors as able to have "serious adverse affects" unless you've programmed your own rejection handling in OnOrderUpdate(), and says user-defined rejection handling should only be attempted by experienced programmers. If you bought a strategy, ask the vendor which mode it uses and what its code does when a stop-loss order is rejected. A vague answer is useful information.
Exit on session close (IsExitOnSessionCloseStrategy, on by default) cancels the strategy's orders and closes its positions at the end of the session, with ExitOnSessionCloseSeconds setting how many seconds before the close it acts. NinjaTrader says it's designed for intraday strategies only, and warns that with non-time-based bars such as Renko and Break at EOD off, the exit can trigger after the session close in historical processing. For a swing strategy that holds overnight, this is a setting to turn off deliberately, not to discover the next morning.
Some strategies hand trades to an ATM Strategy (NinjaTrader's preset stop and target brackets) with AtmStrategyCreate(). According to the documentation:
So a backtest of a strategy that relies on ATM handoff doesn't show the trades that the ATM actually manages.
NinjaTrader's settings also explain several common gaps between Strategy Analyzer results and live behavior:
None of this makes a backtest useless; it means you need a forward test. Our guides on backtesting and testing a bot before going live cover the wider process.
For broker-side checks before connecting any automation to a live account, see our brokerage connection checklist. If you're comparing NinjaTrader with other desktop platforms on restart behavior, our ATAS vs Sierra Chart automation guide covers how those two handle disconnects. And if a live strategy has already lost money because of a mismatch, read what to do when a trading bot loses money.
IsAdoptAccountPositionAware to true, and only one strategy with this setting can start at a time for an account and instrument.Educational research based on NinjaTrader 8 Help Guide and NinjaScript documentation checked on December 2, 2026; default values and behavior can change between versions, so confirm them in your installed build. We did not run hands-on tests, and this article contains no sponsored or affiliate links. Nothing here is trading advice. Automated futures trading uses leverage and can lose more than your initial deposit.
Get our free Top 5 Bots for Early Retirement report plus The Bot Report newsletter — the bots we'd actually trust to compound over the long term.