NinjaTrader 8 Automated Trading: A Practical Setup Guide
NinjaTrader 8 automated trading runs through NinjaScript strategies that you enable on a chart or in the Strategies tab and research in the Strategy Analyzer. This guide covers the setup order and the settings that decide what happens when something breaks.
On this page
- 01What is a NinjaScript strategy?
- 02How do you start NinjaTrader 8 automated trading on a chart?
- 03Why run in simulation first?
- 04Strategy Analyzer versus live results: what is the difference?
- 05Which order handling and connection loss settings matter?
- 06Do you need a VPS to run NinjaTrader 8 strategies?
- 07Is automation allowed on a prop firm account?
- 08Frequently asked questions
The short answer
NinjaTrader 8 automated trading means running a NinjaScript strategy: C# code that places orders for you. Enable it from a chart or the Strategies tab, test on the Sim101 account first, and treat Strategy Analyzer results as historical estimates. Check start behavior and connection loss handling before going live, because the default start mode does not check your account position. Whether a prop account permits automation is the firm's decision.
Key takeaways
- A NinjaScript strategy is C# code that submits and manages orders inside NinjaTrader 8, whether you write it, generate it in the Strategy Builder or import it.
- The default start behavior, Wait until flat, does not check your account position, so start with the account flat or read the sync documentation first.
- Strategy Analyzer fills are estimates from bar data, and NinjaTrader documents why real-time results can differ.
- Connection loss handling and realtime error handling decide how a strategy reacts when something breaks, so find out what the author chose.
- A VPS keeps the platform running, but whether automation is allowed on a prop account is a question only the firm can answer.
What is a NinjaScript strategy?
NinjaTrader 8 automated trading runs through NinjaScript strategies: C# code that lives inside the platform and submits, changes and cancels orders by its own rules. A strategy reads its data series and indicators, applies its logic and sends orders to the account you assign.
You can get one three ways: write it in the NinjaScript Editor, generate it with the Strategy Builder, or import an archive through Tools, Import, NinjaScript. NinjaTrader's import page advises importing only from a trusted source. Imported code may not let you read the logic, which matters when you need to know why an order went out.
The settings that govern failure deserve as much attention as the entry signal, so most of this guide covers them. Labels below come from NinjaTrader's help guide as read in November 2026. Check the current guide for your build.
- Strategy Builder: generates a NinjaScript strategy from rules you select, for simpler logic.
- NinjaScript Editor: full C# control over entries, exits and risk checks.
- Imported archives: convenient, but you may only know what the author documents.
How do you start NinjaTrader 8 automated trading on a chart?
Open the Strategies window from the chart's right-click menu, the toolbar icon or Ctrl+S. Add the strategy from the Available list, set its properties, set Enabled to True and click OK, as described in the chart guide. The platform must be connected to a brokerage or data vendor, though Replay and Simulated Data Feed connections also work. A strategy started from the Strategies tab in the Control Center runs without appearing on a chart.
Three properties deserve a second look. Account decides whether orders go to simulation or to a live connection. Data Series decides what the strategy sees, so logic built for one-minute bars will behave differently on another series. Exit on close covers the end of the session, so know how it is set before you hold through one.
Start behavior is where the name misleads. The default is Wait until flat, and per NinjaTrader's syncing page it does not check or change your account position. It waits for the strategy's own virtual position to reach flat, then sends live orders. If the account holds a position at that moment, the two will be out of sync. The synchronize options can close or place live trades, and Adopt account position appears only if the developer built the strategy for it.
After enabling, open the Strategies tab. It shows strategy position, account position and a Sync column. Two more documented traps: manually cancelling a strategy order can stop the strategy from executing as expected, and clicking Close on an account and instrument with a running strategy disables it.
Why run in simulation first?
Because it is the cheapest place to learn that a strategy double-enters or ignores its stop. Select Sim101 and the strategy trades through NinjaTrader's simulation engine, which weighs volume, time in the order queue and random delays instead of filling whenever price touches your order. The fills are still estimates, with no real order in the market.
Write down the behaviours you are checking before you start, so a quiet week does not pass for a successful test. Run at least one full session, including the open and the close, plus a news release day if the instrument reacts to them. Compare what the strategy did with what you expected, order by order.
To repeat a specific session, the Playback connection replays recorded data. NinjaTrader calls Market Replay data its most accurate option and says Playback from start is useful for strategy testing. It also notes that simulated internet latency is absent in playback, so fills there can differ from Sim101.
Log every surprise: a rejected order, a stop that moved late, a position that stayed open after you disabled the strategy. Those are far cheaper to find here than on an evaluation account with a loss limit behind it.
- Does every entry have a protective stop attached, at the price you expect?
- Does the strategy stay at the position size you set after partial fills?
- What happens to orders and the position when you disable it?
- Does the Sync column stay true after you trade the same instrument by hand?
- Does it respect a daily loss limit you coded yourself?
Strategy Analyzer versus live results: what is the difference?
The Strategy Analyzer runs a strategy over historical data and covers backtesting, optimisation, walk-forward optimisation, basket testing and Monte Carlo simulation, as listed on NinjaTrader's Strategy Analyzer page. It tells you how the rules would have behaved under the simulation's assumptions. It says little about how they will fill tomorrow.
NinjaTrader's discrepancies page gives the reasons. Backtests can only use each bar's open, high, low and close, so an order may fill in a test and not in real time. Backtests also process at bar close, while a real-time strategy can process each tick, so a condition can be true inside a bar and false at its close. For method, see how to backtest an EA, and for live fills, slippage and execution.
Do not optimise until a result looks good and then call it validated. Parameters tuned to one stretch of history tend to fit that stretch, as EA optimisation and overfitting explains. Walk-forward testing shows whether settings hold on data they were not tuned on, and live results can still differ.
| Strategy Analyzer | Sim101 account | Live account | |
|---|---|---|---|
| Data | Historical data | Live or simulated feed | Live market data |
| Fills | Estimated from bar values, order price and fill algorithm | Modelled from volume, queue time and random delays | Real, set by bid, ask and available volume |
| Processing | At bar close | Can run on each tick | Can run on each tick |
| Slippage | A setting you enter | No real order in the market | Real |
| Best used for | Testing logic and parameters | Testing order handling and behaviour | Only after the first two look sound |
| Main risk | Overfitting to the past | A false sense of fill quality | Real money and real rule limits |
Which order handling and connection loss settings matter?
The strategy author sets how it reacts to broken connections and rejected orders. NinjaTrader's reference pages show both as properties set in the strategy's code, so if you did not write it, ask the author what they chose.
On connection loss, the ConnectionLossHandling page lists three options, with Recalculate as the default. A strategy stops if the data feed is down longer than DisconnectDelaySeconds, if the order feed is down and the strategy tries an order action, or if both feeds are down longer than that delay. If the connection returns before any of that, Recalculate keeps running without recalculating.
On rejected or failed orders, the RealtimeErrorHandling page makes StopCancelClose the default. It warns that IgnoreAllErrors can have serious adverse effects unless you have programmed your own rejection handling.
| Setting | Option | What NinjaTrader documents |
|---|---|---|
| Connection loss | KeepRunning | Resumes on reconnect as if no disconnect occurred |
| Connection loss | Recalculate (default) | If it was stopped, tries to recalculate strategy position on reconnect |
| Connection loss | StopStrategy | Stops when disconnected past the delay, no action on reconnect |
| Realtime errors | StopCancelClose (default) | Stops, cancels working orders, closes positions the strategy manages |
| Realtime errors | StopCancelCloseIgnoreRejects | Same on all errors except order rejections |
| Realtime errors | IgnoreAllErrors | Keeps running, your code must handle rejections |
Worked example
Illustrative numbers only. A strategy holds 2 contracts long with Recalculate selected and DisconnectDelaySeconds at 60. If the data feed drops for 90 seconds, 90 is past 60, so the strategy stops and tries to recalculate its position on reconnect. If the feed drops for 40 seconds, the strategy keeps running with no recalculation. Either way, check the Strategies tab afterwards. Suppose you closed 1 contract by hand meanwhile: the account position is then 1 long while the strategy position can still read 2 long. The account position is the real one.
Do you need a VPS to run NinjaTrader 8 strategies?
No, but a strategy only trades while NinjaTrader is running and connected. A laptop that sleeps, updates or loses wifi will interrupt it. A VPS is a remote machine that stays on, so the platform keeps running when your own computer is off.
It adds its own failure points: remote desktop sessions, memory limits and connection routes you cannot see. Test the whole setup in simulation on the VPS, and check what happens to the strategy after a reboot. The trade-offs are covered in VPS versus a local PC for a trading bot.
A VPS removes one cause of interruption and adds no trading edge. It also does not change what a firm permits. If a policy limits where or from which device you trade, read it in the firm's terms before you set anything up, as IP and device rules describes.
- Match the operating system to NinjaTrader's minimum requirements, which listed Windows 11 or Windows Server 2016 or later, 64-bit, as read in November 2026.
- Know which connection loss option the strategy uses before you leave it unattended.
- Keep a way to flatten the account that does not depend on the strategy itself.
- Never assume a restart restores a position correctly. Compare strategy and account position.
Is automation allowed on a prop firm account?
Whether NinjaTrader can run it and whether a firm allows it are separate questions. Automation in futures depends on each firm's policy, which can differ by account type and platform and can change over time. Confirm with the firm directly before you enable anything on an evaluation or funded account.
The general picture is in futures prop firm automation rules, and the platform comparison is in NinjaTrader versus MetaTrader for prop firms.
PraxAI publishes this blog and sells automation software, so weigh that. It supports NinjaTrader 8 for futures. On that platform, treat PraxAI GUARD as a risk control only and test it on a demo account, which you can do only after purchase. Confirm with your firm that automation is permitted before relying on any of it.
Frequently asked questions
Can I run an automated strategy on NinjaTrader 8?
Yes. NinjaTrader 8 automated trading uses NinjaScript strategies that you write, generate with the Strategy Builder or import. Enable one from a chart or the Strategies tab, assign an account and start on simulation. Whether you may use it on a prop account depends on that firm's policy.
Does a NinjaTrader strategy wait for my account to be flat before it trades?
Not exactly. The default, Wait until flat, does not check your account position. It waits for the strategy's own position to reach flat, then goes live. If the account holds a position at that point, the two are out of sync.
Is the Strategy Analyzer result what I will get live?
No. It estimates fills from historical bar values, and NinjaTrader documents why real-time results can differ. Use it to test logic, then check order handling on a simulation account.
What happens to my position if my connection drops?
It depends on the strategy's ConnectionLossHandling setting: KeepRunning, Recalculate or StopStrategy. After any outage, compare strategy position with account position in the Strategies tab.
Do I need a VPS for NinjaTrader 8 automated trading?
Not strictly, but a VPS keeps the platform running when your own computer is off. Test the whole setup in simulation on it first, and check what happens after a reboot.
Educational content, not financial advice. Trading leveraged products carries a high risk of loss, and no strategy or software guarantees a pass or a payout. Prop firm rules differ by account type and change over time, so check the current terms on the firm's own site before you trade.
