From the March 2013 issue of Futures Magazine • Subscribe!

System development final step: Money management, Monte Carlo and a review

Monte Carlo simulation

The final results of our optimizations are encouraging, but first we must determine whether the results are because of the system exploiting a reliable pattern of market behavior or if it’s a happy coincidence between the current market environment and the order of our trades. (Of course, we are using a random system; any edge would result from the optimized price and time stop controls.)

To answer this question, we turn to Monte Carlo simulation, which was invented in the 1940s by scientists working on the Manhattan Project. They used statistical sampling to help in modeling thermonuclear reactions. In situations where mathematical models of a process are either too complex or difficult to derive, using many simulations of the process can provide the information necessary with a high degree of accuracy.

For trading purposes, the one criterion that can be simulated easily is the order in which trades occurred. A proper Monte Carlo simulation involves running 1,000 or more trials where the order of the trades is randomized and the results tabulated. Sophisticated software exists for automating this process, as well as some simpler programs that work within Microsoft Excel. We will load the merged data from our walk-forward tests into a simple Excel spreadsheet; the trade order then is manually randomized. We will restrict the simulation to 120 trials.

However, it is not enough simply to scramble the trade order and add the wins and subtract the losses. The basic commutative property of arithmetic tells us that no matter the order of the trades, the final result is always the same. Yes, the equity curves will vary substantially, and in some instances the account balance may become negative (which in reality would result in the cessation of trading), but such an analysis would have little value.

For each simulated trade order, we will use the following procedure:

  1. Calculate the number of lots traded with the trade-size algorithm using the current account balance and the initial stop loss that was in place for the current trade.
  2. Multiply the number of lots by the actual number of pips won or lost on that trade to determine the dollar amount won or lost. Remember, in our system, one pip = $1.
  3. Add or subtract that amount from the account balance to obtain a new account balance.
  4. Repeat steps one, two and three for all remaining trades.

By doing the simulation this way, the running account balance accurately reflects the effect of the trade size algorithm in determining the amount of profit or loss for a given trade, regardless of the order in which that trade occurs.

“Equity curve madness” (above) is a composite of 16 representative equity curves created by the spreadsheet for each of 16 randomized trade orders. These equity curve screenshots were taken at random from the set of simulations. These simulations fell into the following categories in terms of their bottom-line profitability:

  • Positive net profit: 112 (93.33%)
  • Breakeven (+/–$50 or less): Two (1.67%)
  • Negative net profit: Six (5%)

Though it would be better to run 1,000, these simulations clearly demonstrate the advantage of running the Monte Carlo analysis. As can be seen from the shape of the equity curves, the results run the gamut from nearly flat to wide fluctuations in trade-by-trade equity. Compare these to the equity curve from our walk-forward tests: None exhibits the relative smoothness of that curve. This information is needed before deciding to deploy a system: Whether or not the potential exists for wide swings in the day-to-day equity of the system. Clearly, that potential exists with our random entry system.

This series has provided a framework for developing automated trading systems. We started with our market model, and then collected data using the simplest system based on that model. Applying statistical analysis, we derived maximum adverse excursion and maximum favorable excursion data for use in finding optimal stop losses and profit targets.

Along the way, we discovered that the base system had a negative expectancy, but that a simple change of a single parameter turned expectancy positive, saving the system from the trash heap. Adding a stop loss produced an acceptable compromise between reduced profit and limitation/quantification of risk, but adding a profit target reduced profit too much to be acceptable. The profit target was discarded, leaving the system time stop as the sole means of exiting trades. 

Applying money management in the form of the trade size algorithm demonstrated the importance of having a stop loss to quantify risk. We also saw how proper trade sizing could increase profitability greatly. Finally, Monte Carlo analysis demonstrated that the system is robust as the majority of simulations produced profitable results. However, the Monte Carlo analysis also demonstrated that the system will tend to produce wide fluctuations in equity such that, despite its seeming robustness, it would be unwise to deploy the system in the markets trading real money without further modification.

One purpose of this series was to reflect the real issues and frustrations, as well as the triumphs, surrounding the development of an automated trading system. To that end, these articles were written in real time: The results of the subsequent step were not known prior to completing the previous installment. There was no attempt to massage data to depict a perfect up-sloping, linear equity curve. It is often the case that an idea that seemed so promising in our minds turns out to be a losing proposition. When you are searching for a diamond in the rough, you have to dig through a lot of dirt to find it.

<< Page 3 of 4 >>
Comments
comments powered by Disqus
Check out Futures Magazine - Polls on LockerDome on LockerDome