Monte Carlo How-To thread

Discussion in 'Economics' started by tenthousandmen, Jan 15, 2012.

  1. Monte Carlo How-To thread
    There seems to be allot of confusion on the board regarding what Monte Carlo simulation is and how it protects traders from disastrous drawdown's and blowing up their account. I thought I'd share what I learned with anyone who has not yet taken advantage of using Monte Carlo with their backtest data.




    How Monte Carlo works - an example:

    With a set of backtest data from 01/2008-01/2012 (four years) - the Monte Carlo simulation works by randomly selecting x% of the trades (usually 25% of the trades) during the four year period. The simulation repeats over and over N times - it's recommend to use at least N > 1,000.

    So for this four year period, a 25% sample would create data for a one year period.

    Using the maximum drawdown in your original backtest data is not an accurate way to determine the statistically worst drawdown in the future. By running thousands of 25%-sample simulations, you can more confidently determine the absolute worst-case scenario going forward by looking at which sim had the largest drawdown - in other words, which sim had the "worst luck" by randomly selecting the worst trades during the four year backtest period.

    You may be surprised to find that the worst-case Monte Carlo sample may have a significantly worse drawdown than your original backtest data. Use this point as your worst case scenario - not the maximum drawdown in your original backtest data - and calculate your necessary leverage over time from there. Common ways to calculate leverage over time are the Kelly Criterion, Half-Kelly, and Sharpe Ratio formulas.





    Outside of Monte Carlo, it is also important to consider that any system, no matter how non-curve fitting it may be, does not last forever. You should always be looking for other technical edges, as well as trading other non-technical methods such as more generic support/resistance, MA crossovers, etc. Also, consider keeping up your discretionary skills with paper trading, so that you'll have something to confidently fall back on when your system fails earlier than expected!

    To calculate Monte Carlo sim's - check if your software platform has this feature integrated. Ninjatrader has Monte Carlo simulations in the Strategy Analyzer window; just right click on the "trades" tab on your backtest data and select Grid > Monte Carlo Simulation. If you don't have Ninja, you can download it for free to run your data via the free historical feed. Some Excel files available from Microsoft for free also do Monte Carlo simulations.

    I hope this helps clear up what Monte Carlo simulation is and how you can use it with your trading. If I missed anything, please post and add on! :cool:
     
  2. @tenthousandmen,

    concerning the so-called MCS based system stresstest you've said the main important things.

    In my experience it's also not bad to use all available historical data and do a bunch of simulation runs (>= 10.000), to get a better feeling of max possible DDs. So Excel may be a little bit slow for such huge evaluations. Using MCS Software compile in native code is far far faster... :)

    But this stress test is not the only possibility of using MCS methodology in the trading system development process. It can also be used in generating so-called synthetic data (based on an origin historical data file) and so specially for so-called "many markets-many time frames"-systems you have a professional test environment.

    See also here:
    http://www.zentrader.de/html/monte_carlo_simulator1.html

    bye,
    Volker
     
  3. Here are two screen shots of monte carlo in action - one is of the original draw down data, the other is of the monte carlo draw down data. A big difference!

    [​IMG]
    [​IMG]
     
    • si.jpg
      File size:
      384.6 KB
      Views:
      545
  4. Here's the draw down related to the other attachment...
     
  5. P/F 1.3 with a 21% win rate.

    Yikes!!!
     
  6. I wouldn't touch it with a $5 bill.:eek: However I think there are more losing trades than normal because silver doesn't do much overnight, and the back test wasn't set for session hours only (hence the low average losing trade).