This slides presents two types of simulation in trading system: trade shuffling and trade simulating. Trade shuffling is common in most trading system software using trades from a backtest and randomly shuffling orders of those trades to get many equity curves and also CAR and MDD. On the other hand, trade simulating requires application to run many backtests to get a set of results, equity curves. Its simulation and random takes place in modeling slippage, missing trades, noise, and many others in order to get results that close to actual trading operation. In the end, comparisons between trade shuffling and trade simulating are discussed along with their advantages and disadvantages.
4. What is Monte Carlo Simulation?
A method uses random sampling to calculate statistics of a process.
Examples of Random Sampling:
• Instead of buying stocks A-B-C in this order, the order could be B-C-A or C-A-B
• Instead of setting slippage to a constant 10%, it could be set to a random number 5% to 15%
Examples of Calculate Statistics:
• Instead of average CAR 40%, 10% chance that CAR will be less than 27%
• Instead of average MDD 15%, 10% chance that MDD will be greater than 9%
Please read: AmiBroker User’s Guide: Monte Carlo Simulation of your trading system4
5. MC Simulation in Trading System
•Model and backtest a trading strategy/system
•Random sampling repeatedly: trades or numbers
•Calculate statistics to summarize results
•Construct cumulative distribution function (CDF) of those results
5
<= 10% chance that CAR < 27% <= 90% chance that MDD < 9%
<= 10% chance that MDD > 9%
Random Sampling: Trades
6. MC Simulation in Trading System
1. Model a system (trading strategy) in order to get results such as CAR and MDD
2. Backtest system/strategy consisting of several processes (buy, sell, cut loss,… )
3. Repeatedly random sampling from the processes to get various results
Random sampling for trading system could be
1. Trades such as buy and sell stocks. “Trade Shuffling”
2. Random numbers added into parameters such as slippage. “Trade Simulating”
4. After random sampling for 1000 times, 1000 results of CAR are obtained.
5. Then calculate statistics to summarize the results such as an average of CAR
6. Construct cumulative distribute function, CDF
6
8. 2 Types of Monte Carlo Simulation
• Trade Shuffling
• Set parameters in AmiBroker’s built-in Monte Carlo Simulation
• Backtest 1 time and get 1 trade list, consisting of many Trades with %profit/loss
• Shuffle orders of the Trades 1,000 times to get 1,000 results and equity curves
• Summarize the results: average CAR, minimum CAR, CDF of CAR, …
• Trade Simulating
• Code random numbers into various parameters such as slippage and missing trades
• Backtest 1,000 times to get 1,000 trade lists in optimization table results
• Copy results into Excel and use Excel table to summarize the results
• Summarize the results: average CAR, minimum CAR, CDF of CAR, …
8
9. Recap: 2 Types of MC Simulation in Trading
Trade Shuffling
Use AmiBroker’s Built-in MC Feature
1 Backtest -> 1 Trade List -> Shuffle trades for 1,000 times -> 1,000 Equity Curves
Trade Simulating
Use user’s code and optimize function
1,000 Backtests -> 1,000 Trade Lists -> 1,000 Equity Curves
9
10. Trade Shuffling MCS
Advantages
• AmiBroker’s built-in feature (ready to use)
• Provide necessary basic statistical parameters
• Fast. Require short computational time
• Suitable for new traders in testing and designing
Disadvantages
• Assumption of independent trades
• Results derived from the same trade list
• Limit position sizing methods
• Missing various important statistical parameters
Trade Simulating MCS
Advantages
• User controls all aspects of simulation model
• Perform Sensitivity Analysis
• True simulation trading model
• Use the assumptions to monitor actual trading
Disadvantages
• User’s assumptions: slippage, missing trades, …
• Not readily to use
• Slow. Take times to run many backtests
• Manually calculate all statistics by user
10