Guide 01
What is an automated trading strategy?
An automated strategy is a trading plan written so precisely that a computer can follow it without a human deciding anything in the moment. This guide explains the parts, how it differs from discretionary trading, and how NinjaTrader runs one.
01Rules-based versus discretionary
A discretionary trader looks at a chart, forms an impression and decides. The decision might be good, but it is hard to describe and impossible to test exactly, because the same chart can feel different on a different day.
A rules-based trader writes the decision down as conditions that are either true or false. "Buy when the 20-period average crosses above the 50-period average, and the market is trading above its session open" can be checked by a machine on every bar. An automated strategy is a rules-based strategy that also submits the orders itself.
The two ideas are separate. You can follow written rules by hand, and you can automate a plan that you only trust because you reviewed it carefully. The real benefit of writing rules is that you can test them on past data, which is covered in the backtesting guide.
02The four components
Almost every strategy, however complex, is built from the same four pieces.
1. Entry
The condition that opens a position: a price level, an indicator crossing, a pattern, a time of day. It must say which direction (long, short or both) and what order type is used, such as market or limit.
2. Exit
How the trade ends. This usually means a protective stop loss, a profit target, a trailing rule, a time-based exit, or a combination. Many failed strategies have a detailed entry and a vague exit. The exit often decides the result more than the entry does.
3. Position sizing
How many contracts to trade. It can be a fixed quantity or derived from the distance to the stop and the amount you are willing to risk. See risk management.
4. Filters
Conditions that stop the strategy from trading when it should not: outside a chosen session window, around scheduled news, when volatility is too low or too high, or after a daily loss limit is reached. Filters reduce trades; they do not make a weak idea strong.
03How NinjaTrader runs a strategy
NinjaTrader 8 strategies are written in NinjaScript, its C#-based scripting language. You can write the code yourself, use the platform's point-and-click Strategy Builder for simpler logic, or load a strategy from a vendor. Once compiled, the same strategy can be used in two very different ways.
- In the Strategy Analyzer, it runs against historical data and produces a performance report: trades, profit factor, drawdown and so on. This is a backtest.
- On a chart or in the Strategies tab of a control center, it runs on live or simulated data and places orders on an account you choose, usually a simulation account first.
Each strategy has parameters, such as the period of a moving average or the stop distance, which you set when you apply it. Those inputs matter more than they look, and the overfitting guide explains why.
For platform setup, data feeds and how to enable a strategy on a chart, the free guides at NinjaTrader Guru cover the step-by-step side so this site can stay focused on the thinking.
04What automation does and does not do
Automation removes hesitation, hurried decisions and some kinds of emotion. It does not remove risk. A strategy will lose money in market conditions it was not designed for, and a technical failure such as a lost connection or a stalled computer can leave an order in the market unmanaged. Anyone running a strategy live needs a plan for those events.
It also does not remove the need for judgment. Someone still decides which strategy to run, how much to risk, and when to switch it off. That is why the later guides on forward testing and monitoring matter as much as the code.
Past performance does not guarantee future results, and that is especially true of a backtest, which is a simulation of what would have happened under assumptions you chose.
FAQFrequently asked questions
Do I need to know how to code to use an automated strategy?
Not necessarily. NinjaTrader includes a Strategy Builder for simpler logic, and strategies can be obtained ready-made. Coding in NinjaScript gives more control, but you still need to understand what any strategy you run is doing.
Is an automated strategy the same as a trading bot?
In everyday use the terms overlap. "Automated strategy" usually stresses that the rules are explicit and testable, while "bot" often implies only that orders are sent automatically.
Can an automated strategy lose money?
Yes. Any strategy can lose money, including one that tested well. Markets change, and tests rely on assumptions. Futures trading involves substantial risk of loss.
Where do I learn the NinjaTrader setup steps?
NinjaTrader Guru publishes free step-by-step guides for the platform. This site covers the strategy concepts around them.