Top

Get the Most Out of Your Trading Strategies with Optimization

automated strategy optimization analyzer backtest

NinjaTrader’s powerful Strategy Analyzer allows traders to backtest their automated trading strategies using historical market data. In addition, traders can run an optimization test to help determine what parameters could lead to the best performance in the live markets.

For example, what period of a moving average and chart interval would perform best when using moving average targets as a sell signal? These variables can be tested across any number of combinations for various performance outcomes. Optimization helps traders determine which combination could best position their strategy in the live markets.

How Does Strategy Optimization Work?

Similar to a backtest, an optimization will run your automated strategy over historical data to test and analyze performance. The key difference is that an optimization tests multiple settings to determine which approach would have performed the best. This feedback is crucial for strategy builders to refine and improve their algorithms and automated systems.

Performing an Optimization

In order to run an optimization, the NinjaScript strategy used must have inputs to optimize. For example, inputs can be the period of a moving average, an overbought or oversold RSI threshold, or any other indicator parameter which can be predefined by the user.

  1. Within the Settings panel of the Strategy Analyzer window, under Backtest type select Optimization. Once Optimization is selected, additional settings will appear.
  2. Under Strategy parameters, the available inputs for the selected strategy can be found.
  3. Configure the necessary strategy parameters for your optimization.
  4. Set the number of best results to keep.
  5. The Optimize on setting provides an extensive list of items to base the optimization results on.
  6. Once all settings are configured as desired, click Run to perform the optimization.

Viewing Optimization Results

Once the optimization is complete, the results can be found in the Performance Results panel on the left-hand side of the Strategy Analyzer window.

In the top left-hand section, each test performed during the optimization will appear. The Parameters column displays which values were used for the inputs of each test.

To view the detailed performance results of each test, select the desired test from the top and the results will appear in the lower left-hand section. The type of report displayed will depend on the style selected in the Display drop-down menu.

Regardless of the strategy or optimization results, traders should be aware of the risks involved and manage exposure to unpredictable markets.

Backtesting and optimizing are crucial steps in ensuring your automated strategy is ready for live markets. The NinjaTrader platform is always FREE for backtesting, advanced charting and trade simulation. Get started with our award-winning trading platform!