Top

Backtest & Optimize Automated Strategies with the Strategy Analyzer

automated strategies backtest optimize

NinjaTrader’s Strategy Analyzer is a powerful tool to test automated strategies using historical trading data. Based on this analysis, traders can optimize their strategy for peak performance in live market conditions.

Designed for use with strategies built using NinjaScript, NinjaTrader’s modern C# based trading framework, the Strategy Analyzer provides a robust solution for backtesting, optimizing and analyzing the performance of automated trading strategies.

Get Started with Strategy Analyzer

From the Control Center click New > Strategy Analyzer. This window is separated into two main sections:

  • Settings panel (outlined in yellow)
  • Performance Results panel (outlined in green)

Settings Panel

The Settings panel is where users can select the Strategy Analyzer parameters applied including:

  • Strategy: Specify the NinjaScript strategy to backtest or optimize.
  • Instrument: Denote which instrument or instrument list will be used. Selecting an instrument list is a great way to quickly ascertain how multiple instruments would have historically performed and compare that data.
  • Type/Value: Specify which interval type and value will be used in the backtest or optimization.
  • Time frame: Specify the period of time used in the backtest. Please note that in order to run a backtest over historical data, NinjaTrader must be connected to a data provider which supplies the appropriate historical data or this data must be saved prior to running the backtest.

Once set to the desired preferences, click Run to perform the backtest. The Strategy Analyzer will display a message in the bottom right corner of the window to indicate if a backtest is still running.

Performance Results Panel

Once completed, the backtest results can be viewed in the Performance Results panel.

Located to the left of the Settings panel, the Performance Results panel displays results based on the report selected in the Display selector, highlighted above.

If a backtest was run using an instrument list as demonstrated in the window above, a list of each instrument will appear at the top of the Performance Results panel. Here, you can select each instrument’s individual results as well as the combined results of the entire instrument list.

Below are a few of the report styles available within the Display selector:

  • Summary: Displays all performance statistics and metrics (pictured above)
  • Analysis: Displays data based on various time periods for analysis
  • Chart: Displays a price-over-time chart with order executions plotted over the price data
  • Executions: Lists individual entries and exits
  • Trades: Lists individual trades
  • Orders: Lists the orders used

The example below features the Charts display selected within the Performance Results panel.

Interested in building and testing your trading strategies using an open source trading platform? NinjaTrader is always FREE to use for advanced charting, backtesting and trade simulation. Get started now!