Backtesting

Overview

In Backtesting mode, the porfolio's Strategies are simulated on historical market data. All of the strategies run at once. At the end of each day (by default), portfolio-level scripts (Dynamic Allocation, Tax System) are run.

In Automated Trading, IQBroker basically has two modes: before and after running a backtest.

  • Before running a backtest: all of the Portfolio Settings are enabled, which allows you to change them. But all of the controls that show the results of a backtest are disabled: e.g., the top-level tabs Workspaces, Positions, etc. 
  • After running a backtest: most of the Portfolio Settings are disabled. However, the controls that show the results of the backtest are enabled.
  • After you've finished viewing the results of a backtest, click Reset to return to the initial state.

Backtesting Settings

Standard (Fast) - run backtesting at full speed

Playback (Slow) - run with delays, allowing you to monitor the progress

If you run the backtest in Playback mode then you can view its progress in real-time in tabs such as Workspaces, Positions and Orders. You can even inject your own trades: open one of the charts; open its attached Trade Pad; and submit orders. However, the Performance tab only updates once the backtest completes.

Running a Backtest

To start the backtest, click Start:

If any data is missing then the data will be loaded first, and then the backtest will start running.

While a backtest is running, the progress bar shows its progress. The "Portfolio Time" indicator shows the simulated date that the backtesting has reached.

If you wish, you can click Pause to stop the backtest prematurely and examine its results up to that point. (If you Pause a backtest then you can't resume running it; you must restart from the beginning.)

After the backtest has finished running, click Reset to discard the results of the backtest and prepare to run a new backtest. Many of the portfolio settings are disabled until you click Reset.

Analyzing Results

After you run a Backtest, the Performance tab automatically opens to show the results:

You can also view the other tabs to see what the trading strategies had done:

  • Workspaces - contains a chart for each of the symbols
  • Strategies - shows information about the performance of each of the strategies
  • Positions - positions taken
  • Trades - trades performed
  • Orders - orders executed
  • Taxes (optional) - taxes that you would have to pay
  • Transfers (optional) - cash transfers between the strategies