Automating a strategy on NinjaTrader: from idea to live
How to automate a strategy on NinjaTrader 8: write or buy the code, test it in the Strategy Analyzer, run it in simulation, then go live at one contract.
You can take an idea, open the Strategy Builder in NinjaTrader 8, and have something placing live orders before dinner. That is not the hard part. The hard part is everything between "it compiles" and "I know what this does over seven years, including the worst stretch."
Here is the whole route, in the order it should happen, with the places people skip marked clearly.
Two ways to get there
Either you write the strategy or you buy one. Both end at the same place, a compiled NinjaScript strategy running on a chart, but they front-load very different work.
| Writing it yourself | Buying a finished system | |
|---|---|---|
| Up-front cost | Your time, weeks to months | The license price |
| What you must supply | The edge, the code and the testing | Judgment about whose evidence to trust |
| Biggest risk | Curve fitting your own idea | Buying a track record that was never real |
| Who fixes it later | You, every platform update | The vendor, if they are still there |
| What you learn | A great deal | Less, unless the rules are published |
Neither is obviously right. Writing it teaches you more than any article can, and most first strategies do not survive honest testing. Buying skips the coding and moves the whole problem to evaluating evidence, which is its own skill.
Automation is the last step, not the first. The platform will faithfully execute a bad idea forever, at machine speed, without complaint. Decide whether the rules are worth executing before you make them executable.
What the machine needs
That last item causes more support tickets than anything else. A correctly installed strategy on the wrong instrument or timeframe does nothing at all, and looks broken while behaving exactly as designed.
Stage one: write the rules in English first
Before any code, the strategy has to be expressible as a short paragraph a stranger could follow. When does it look for a trade? What single condition triggers entry? Where does the stop go, in ticks or in dollars? Where does the target go? What closes the position if neither is hit?
If you cannot write that paragraph, you do not have a strategy, you have a feeling. And a feeling that cannot be written down cannot be coded, which is the useful part of this exercise. The mechanics of turning rules into a decision loop are covered in how a trading algorithm works.
Stage two: the code
NinjaTrader 8 gives you two doors. The Strategy Builder is a visual tool that generates NinjaScript from dropdown conditions, and it handles a surprising amount: indicator crossovers, time filters, stops and targets in ticks. Beyond that you need NinjaScript itself, which is C# with a trading framework around it.
Two rules save most of the pain. First, place the stop and the target at the same moment as the entry, not on the next bar, so a disconnection never leaves a naked position. Second, be explicit about whether logic runs on bar close or on each tick, since a strategy that quietly evaluates mid-bar will backtest very differently from how it trades. A tour of the platform's parts is in NinjaTrader 8 explained, and importing a finished strategy file is covered step by step in how to import and run a NinjaScript strategy.
Stage three: the Strategy Analyzer, configured honestly
This is where a strategy becomes evidence or becomes fiction. The Strategy Analyzer will happily produce a beautiful report from careless settings.
- Full period. Test years, not the three months that happen to suit the idea.
- Real commissions. Enter your broker's actual rate. The published tests assume $1.90 a round turn plus a tick of slippage, and costs of that size are not a rounding error over thousands of trades.
- Slippage. Assume you do not get the perfect fill. See slippage and commissions.
- High fill resolution with tick replay. Otherwise the engine guesses whether your stop or your target was hit first inside a bar, and it tends to guess in your favor.
- Read drawdown before profit. The deepest peak-to-trough figure is the one that decides whether you could have stayed in the seat.
The full walkthrough of those settings lives in how to backtest in NinjaTrader 8. Configure them properly and the same report reproduces on any machine, which is the entire point of publishing one.
Stage four: simulation, which is not optional
A backtest tells you what the rules did to historical data. Simulation tells you what the software does on your machine, on live data, with your connection and your settings. Those are different questions, and only the second one catches a strategy that works perfectly in the Analyzer and misfires at 9:30 in the morning because a session template is wrong.
Run it in the Sim101 account until you have watched it take trades, place its stop and target, and get through a bad day. Market Replay compresses weeks into an afternoon. What simulation cannot show you is the weight of real money, covered in paper trading versus live trading.
The five things that break automations
- Curve fitting. Parameters tuned until the historical equity curve is pretty. The result describes the past and nothing else.
- Look-ahead. Logic that quietly uses information the bar had not produced yet. Backtests beautifully, fails immediately.
- The wrong chart. Right code, wrong instrument, wrong timeframe, or a session template that puts 9:30 AM ET in the wrong place.
- An unattended machine. Windows updates and reboots at the worst possible moment. See VPS for automated trading.
- Interference. Turning the strategy off during a normal drawdown, which takes the losses and misses the recovery.
The first two are development errors, the middle two are operational, and the last one is the owner. In practice the last one does the most damage. A sensible order of operations for all of it, week by week, is laid out in getting started in 30 days, and the broader context in the automated trading guide.
Frequently asked questions
Do I need to know C# to automate a strategy on NinjaTrader?
Not for simple strategies. The Strategy Builder generates working NinjaScript from dropdown conditions and covers time filters, indicator conditions, and stops and targets in ticks. Anything with custom position management or unusual entry logic will eventually need real C#, and every purchased strategy already contains it, so you only need to install and configure rather than write. Knowing enough C# to read the code is still worth having.
How long should I run a strategy in simulation before going live?
Long enough to see it trade normally, place both exit orders, and survive at least one losing stretch without your intervention. In practice that is usually a few weeks of real sessions rather than a few days, because the failures worth catching are operational: a missed connection, a wrong session template, a restart at the wrong time. Market Replay can accelerate the process but does not replace watching it run on live data.
Why does my backtest look better than my simulated results?
Usually the fill assumptions. A backtest run at low fill resolution has to guess whether the stop or the target was reached first inside a bar, and it often resolves that in your favor, so switch on tick replay and high fill resolution. The other frequent cause is missing costs: enter your real commission rate and a slippage allowance, then compare again. A gap that persists after both fixes is worth investigating before any money moves.
Can I run more than one strategy at once?
Technically yes, and NinjaTrader 8 will run several strategies on several charts at once. Practically it multiplies your exposure, your commissions and the number of things that can go wrong on one machine, so it is a poor first move. Get one strategy behaving predictably at the smallest size, then decide whether a second adds anything the first does not.
- NinjaTrader 8 Help Guide, "Strategy Builder", "NinjaScript" and "Strategy Analyzer" documentation.
- CME Group, "Micro E-mini Nasdaq-100 Futures" contract specifications.
- CFTC, "Customer Advisory: Be Cautious of Trading Systems and Robots."
Educational content, not investment advice. Trading futures involves substantial risk of loss and is not suitable for every investor. Any reference to Algomyth results is hypothetical, simulated over historical data, and shown in full on the performance page; past performance does not guarantee future results.
Take the seat: watch the engines live
Three specialist engines on Nasdaq, S&P and Gold, every signal streamed the moment it happens, with the stop and the target written before the trade. From €149 a month per market.

