Monte Carlo Analysis

Zorrocan run a Monte Carlo analysis for its own strategies, as well as for trade lists that are generated by other software and stored in .csv files. The Monte Carlo method improves the performance analysis. It generates not a single sequence of trades and a single equity curve, but a distribution of many possible curves. Compared to standard simulation, the Monte Carlo method produces results that are more accurate and less subject to random fluctuations.

When using Monte Carlo analysis, the equity curve from the backtest is randomly resampled many times. This generates many different equity curves that each represent a different order of trades and different price movements inside each trade. The curves are analyzed, and their results are sorted according to their performance. This way a confidence level is assigned to every result. The confidence level determines how many of the curves had the same or better performance than the given result.

Without Monte Carlo analysis, the annual rate of return is calculated from the backtest equity curve. For example, it might be found that the annual return over the curve was 200%. With Monte Carlo analysis, hundreds or thousands of different equity curves are analyzed, and the annual return determined from them might be, for instance, 145% with 95% confidence. This means that of all the thousands of possible outcomes of the simulation, 95% had annual return rates better than or equal to 145%.

Monte Carlo analysis is particularly helpful in estimating the risk and capital requirement of a strategy. The maximum historical drawdown is normally used as a measure of risk, but this means we're basing our risk calculations on a historical price curve that won't repeat exactly. Even if the statistical distribution of trades is the same in the future, the sequence of those trades and their equity movements are largely a matter of chance. Calculating the drawdown based on one particular sequence is thus somewhat arbitrary: with a sequence of several losses in a row, you can get a very large drawdown. But the same trades arranged in a different order, such that the losses are evenly dispersed, might produce a negligible drawdown. This randomness in the result can be eliminated by Monte Carlo analysis that takes many different equity curves and many different trade sequences into account.

Example of the result distribution in the performance report:

Confidence level     AR   DDMax  Capital
 
 10%                236%  1440$  1390$
 20%                227%  1550$  1470$
 30%                218%  1680$  1570$
 40%                209%  1830$  1680$
 50%                202%  1940$  1760$
 60%                193%  2140$  1900$
 70%                186%  2340$  2040$
 80%                174%  2730$  2320$
 90%                165%  3080$  2580$
 95%                145%  4010$  3580$
100%                104%  5640$  4710$

The first column identifies the confidence level; in the next columns the annual return, the maximum drawdown, and the required capital at that level are listed. The most likely result is at 50% confidence level (here, 202% annual return). This means that half the simulations had this or a better result, and half a worse result. The higher the confidence level, the more pessimistic are the results. The result at 100% confidence level is the worst of all simulations; thus the probability to get this (or an even worse) result is 1/n, where n is the number of simulations. Note that the capital can be smaller than the maximum drawdown when the test period was longer than 3 years (capital and annual return are based on a 3-years normalized drawdown).

The following variables are used for Monte Carlo simulation:

MonteCarlo

Number of simulations for Monte Carlo analysis (default: 200). Every simulation generates a different equity curve. The more simulations, the more accurate is the result, but the more time is needed for the computation. If set to 0, no Monte Carlo simulation is performed.

Confidence

Confidence level for the performance analysis in percent (0..100); determines the calculation of the main performance parameters such as annual return, drawdown, required capital, etc. The higher the confidence level, the more pessimistic are the results. At 0 (default) the performance parameters are calculated from the real equity curve and not from the Monte Carlo simulation.

Remarks

Examples

function run()
{
  MonteCarlo = 1000; // 1000 simulations
  Confidence = 75; // 75% confidence level
  ...

See also:

Testing, Win/Loss, Performance

 

► latest version online