Skip to main content

This guide outlines a comprehensive step-by-step process for conducting a Monte Carlo Analysis in Amibroker. Ensure you’ve read our Mastering Monte Carlo Simulation.

Step 1:

Create a trading strategy with buy/sell rules and assignments. If you need a strategy, refer to our Amibroker Trading Systems.

Step 2:

Go to Analysis → New Analysis

Mastering Monte Carlo Analysis in Amibroker Step by Step.

Step 3:

In the next screen, click on Backtester Settings → Monte Carlo.

Backtester Settings

Here’s what each property in this screen means:

  • Enable Monte Carlo Simulation: Enables or disables Monte Carlo simulation with backtests.
  • Number of runs: Determines how many times the original trade sequence is randomized and backtested (should be 1000 or more).
  • Position Sizing: Sets position size for each iteration of the Monte Carlo simulation (usually the same as the original).
  • Enable MC Equity curves: Displays MC equity charts in the Monte Carlo analysis report.

Don’t change default settings and click OK.

Step 4:

Click ‘Backtest’ to generate the initial backtest report.

Backtest-Results

Step 5:

Click ‘Report’ to generate a detailed backtest report.

Backtest-Report

Step 6:

Click ‘Monte Carlo’ to view the Monte Carlo analysis report.

Monte-Carlo-Results

Interpreting the results:

Focus on the table at the top of the Monte Carlo Analysis report, which provides key statistics. The graphs below are generated from this table data. Here’s an example:

The first column shows percentile levels, indicating where a given percentage of test observations fall. For instance, the 10th percentile represents the percentage of tests with an annual profit equal to or below -0.41%. This helps assess the likelihood of various outcomes.

How to control Monte Carlo Simulation from AFL?

Use these SetOption commands to control Monte Carlo Simulation directly from AFL:

SetOption(“MCEnable”, 0 ); // value == 0 disables MC simulation
SetOption(“MCEnable”, 1 ); // value == 1 enables MC only in portfolio backtests (default)
SetOption( “MCEnable”, 2 ); // value == 2 forces MC to be enabled everywhere (in every mode including optimization – SLOW !)
SetOption(“MCRuns”, 1000 ); // define number of MC simulation runs (realizations)

2 Comments

Leave a Reply