Optimization

Results

Introduction

The optimization results page shows your algorithm's performance with the various parameter values. Review the results page to see how your algorithm has performed during the backtests and to investigate how you might improve your algorithm before live trading.

View Optimization Results

The optimization results page automatically displays when you launch an optimization job. The page presents the algorithm's equity curves, parameters, target values, server statistics, and much more information.

The content in the optimization results page updates as your optimization job executes. You can close or refresh the window without interrupting the job because the optimization nodes process on our servers. If you close the page, you can view all of the project's optimizations to open the page again.

Runtime Statistics

The banner at the top of the optimization results page displays the performance statistics of the optimization job.

Optimization result banner

The banner updates in real-time as the optimization job progresses on our servers. The following table describes the runtime statistics:

StatisticDescription
CompletedThe number of backtests that have successfully completed
FailedThe number of backtests that have failed during execution
RunningThe number of backtests that are currently running
In QueueThe number of backtests that are waiting to start
Average LengthThe average amount of time to complete one of the backtests
Total RuntimeThe total runtime of the optimization job
TotalThe total number of backtests run in the optimization job
ConsumedThe amount of QuantConnect Credit that was used to perform the optimization

Equity Curves

The optimization results page displays a Strategy Equities chart so that you can analyze the equity curves of the individual backtests in the optimization job.

The equity curves of the backtests update in real-time as the optimization job runs. View the Strategy Equities chart to see how the parameter values affect the equity of your algorithm, to see how sensitive the returns are to the range of parameters selected by the optimizer, and to take a closer look at specific times in the backtest history.

Parameter Charts

The optimization results page displays parameter charts to show the relationship between the parameter value(s) selected by the optimizer and the value of several objectives. If your optimization job has one parameter, the result page displays a scatter plot for each objective. If your optimization job has two parameters, the result page displays a heat map for each objective.

Parameter Stability

Zones in the heatmap where the color of adjacent cells are relatively consistent represent areas where the objectives are stable. In these areas, the value of the objectives is not significantly influenced by the parameter values. The following image shows the parameter chart of an optimization job. The highlighted area identifies combinations of parameter values that stabilize the objective function.

Stable objective function

Supported Objectives

You can add parameter charts for the following objectives:

Add Parameter Charts

Follow these steps to add a parameter chart to the optimization results page:

  1. In the Parameter Chart panel, click the plus icon.
  2. Click the Objective field and then select an objective from the drop-down menu.
  3. Click the Parameter 1 field and then select a parameter from the drop-down menu.
  4. If there are two parameters in the optimization, click the Parameter 2 field and then select a parameter from the drop-down menu.
  5. Click Create Chart.
  6. The optimization results page displays the new chart.

Individual Backtest Results

The optimization results page displays a Backtests table that includes all of the backtests that ran during the optimization job. The table lists the parameter values of the backtests in the optimization job and their resulting values for the objectives.

Open the Backtest Results Page

To open the backtest result page of one of the backtests in the optimization job, click a backtest in the table.

Download the Table

To download the table, right-click one of the rows, and then click Export > CSV Export.

Filter the Table

Follow these steps to apply filters to the Backtests table:

  1. On the right edge of the Backtests table, click Filters.
  2. Click the name of the column to which you want the filter to be applied.
  3. If the column you selected is numerical, click the operation field and then select one of the operations from the drop-down menu.
  4. Fill the fields below the operation you selected.

Toggle Table Columns

Follow these steps to hide and show columns in the Backtests table:

  1. On the right edge of the Backtests table, click Columns.
  2. Select the columns you want to include in the Backtests table and deselect the columns you want to exclude.

Sort the Table Columns

In the Backtests table, click one of the column names to sort the table by that column.

Server Stats

The optimization results page displays a Server Statistics section to show the status of the nodes running the optimization job.

The following table describes the information that the Server Statistics section displays:

PropertyDescription
CPUThe total CPU usage and the CPU usage of each node
RAMThe total RAM usage of the RAM usage of each node
HOSTThe node model and the number of nodes used to run the optimization
UptimeThe length of time that the optimization job has ran

View the Server Statistics section to see the amount of CPU power and RAM the optimization job demands. If your algorithm is demanding a lot of resources, use more powerful nodes on the next optimization job or improve the efficiency of your algorithm.

Errors

The following table describes common optimization errors:

ErrorDescription
Runtime ErrorsIf a backtest in your optimization job throws a runtime error, the backtest will not complete but you will still be charged.
Data OverloadIf a backtest in your optimization job produces more than 700MB of data, then Lean can't upload the results and the optimization job appears to never be complete.

View All Optimizations

Follow these steps to view all of the optimization results of a project:

  1. Open the project that contains the optimization results you want to view.
  2. At the top of the IDE, click the Results icon.
  3. A table containing all of the backtest and optimization results for the project is displayed. If there is a play icon to the left of the name, it's a backtest result. If there is a fast-forward icon next to the name, it's an optimization result.

  4. (Optional) In the top-right corner, select the Show field and then select one of the options from the drop-down menu to filter the table by backtest or optimization results.
  5. (Optional) In the bottom-right corner, click the Hide Error check box to remove backtest and optimization results from the table that had a runtime error.
  6. (Optional) Use the pagination tools at the bottom to change the page.
  7. (Optional) Click a column name to sort the table by that column.
  8. Click a row in the table to open the results page of that backtest or optimization.

Rename Optimizations

We give an arbitrary name (for example, "Smooth Apricot Chicken") to your optimization result files, but you can follow these steps to rename them:

  1. Hover over the optimization you want to rename and then click the pencil icon that appears.
  2. Enter the new name and then press Enter.

Delete Optimizations

Hover over the optimization you want to delete and then click the trash can icon that appears to delete the optimization result.

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: