Strategy restore

4 min read

NinjaTrader Start Behavior: account synchronization and order handling

Compare startup modes, understand historical strategy positions, and see why enabling a strategy does not prove the account is synchronized.

Conceptual illustration of an automation gear and an account ledger on unequal stacks, joined by a comparison gauge.

Quick answer

NinjaTrader Start Behavior controls how a NinjaScript strategy starts handling positions and orders when it is enabled. It does not switch a disabled strategy on by itself. Compare the strategy’s calculated position with the actual account position: synchronization modes can place live orders, and adopting an account position requires a strategy designed to support it.

A strategy position is not the account position

A strategy can calculate a position from historical bars before it starts processing live data. That calculated strategy position is separate from the position actually held in the selected account, including a simulation account. Seeing a position in strategy results does not establish that the account received that trade.

For example, imagine a strategy calculates that it is short two contracts while the account is flat. If it later sends a live buy order for two contracts to close its calculated short, the account could become long two. This is an illustrative mismatch, not a trade observed in a test. Account, instrument, direction and quantity all matter when comparing the two states.

What each Start Behavior mode changes

The setting belongs to the strategy’s parameters. Use the strategy developer’s documented startup requirements; there is no single mode appropriate for every strategy and account state.

ModeStartup meaning
Wait until flatWaits for the calculated strategy position to reach or cross flat. Assumes the account is already flat.
Wait until flat, synchronize accountCan flatten the account with a market order, then waits for the strategy position to become flat.
Immediately submitResumes order handling while assuming the account already matches the strategy position.
Immediately submit, synchronize accountCan send a market order to bring the account into line with the calculated strategy position.
Adopt account positionStarts from the actual account position instead of the historical strategy position. Requires developer support.

Previously working orders need a separate comparison

Immediately submit attempts to match previously generated strategy orders using action, type, quantity, limit price and stop price. Unmatched earlier strategy orders are canceled; unmatched active strategy orders can be submitted live. The name does not mean every old order will be adopted.

Wait-until-flat modes first cancel earlier orders generated by the strategy. An unrelated manual order is a separate issue. Startup synchronization is a one-time reconciliation, not continuous protection against later divergence.

Why Adopt account position may be missing

The developer must explicitly make the strategy capable of adopting real account positions. NinjaTrader exposes this through IsAdoptAccountPositionAware, which defaults to false. Changing that flag alone is not a substitute for implementing the required strategy logic.

The platform also restricts adoption when other working orders are present for that account and instrument, and permits only one adopting strategy for that pair at a time. Ask the strategy author how it handles inherited exposure and protective orders; the presence of the menu option does not answer those implementation questions.

Automatic recovery still uses the strategy’s startup rules

An enabled strategy can remain in a waiting state under Wait until flat. That differs from an instance whose Enabled control is off. If the strategy is missing or disabled after restarting NinjaTrader, diagnose that state before treating the problem as account synchronization.

Ninja Watchdog can attempt to restore eligible previously tracked strategies after an interruption. Its recovery code requests that the matching strategy be enabled and checks NinjaTrader’s reported state. That confirmation establishes an enabled instance; it does not establish matching positions, correct protective orders or a new trade.

For an unattended setup, exercise the intended restart in simulation with the strategy author’s supported settings. Compare the resulting account position and working orders with the strategy state. Ninja Watchdog email alerts are available today; SMS and WhatsApp alerts are coming soon.

Official sources

Protect your setup

Keep NinjaTrader recovery automatic

Monitor NinjaTrader, recover supported interruptions, and receive recovery alerts on your Windows computer or VPS.

Start protection