SlideShare a Scribd company logo
1 of 16
Monte Carlo Simulation
AMIBROKER QUANT COURSE
1
Whyperform Monte Carlo Simulation?
•Probability of Risk & Reward
•Worst Scenarios of Risk & Reward
•Strategy Robustness
2
Whatis Monte Carlo Simulation?
Random Sampling
Calculate Statistics
3
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
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
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
Trade Shuffling (AmiBroker’s feature)
Trade Simulating (User’s code)
2 TYPES OF MC SIMULATION
7
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
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
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
Trade Shuffling Example
AMIBROKER QUANT COURSE
11
Trade Shuffling Example
12
Testing from start2011 – end2014
13
Trade Shuffling MC Results
14
Monte Carlo Simulation Template
“Trade Simulating”
AMIBROKER QUANT COURSE
15
Code for Trade Simulating Simulation
•Slippage
•Missing Trades
•Partially Filled Orders
•Additional Noise
16

More Related Content

What's hot

Webinar: You Trade Like a Girl with Mike Bellafiore and Anne-Marie Baiynd
Webinar: You Trade Like a Girl with Mike Bellafiore and Anne-Marie BaiyndWebinar: You Trade Like a Girl with Mike Bellafiore and Anne-Marie Baiynd
Webinar: You Trade Like a Girl with Mike Bellafiore and Anne-Marie Baiyndsmbcapital
 
"Fundamental Forecasts: Methods and Timing" by Vinesh Jha, CEO of ExtractAlpha
"Fundamental Forecasts: Methods and Timing" by Vinesh Jha, CEO of ExtractAlpha"Fundamental Forecasts: Methods and Timing" by Vinesh Jha, CEO of ExtractAlpha
"Fundamental Forecasts: Methods and Timing" by Vinesh Jha, CEO of ExtractAlphaQuantopian
 
From new trader to great
From new trader to greatFrom new trader to great
From new trader to greatsmbcapital
 
Quant insti webinar on algorithmic trading for technocrats!
Quant insti webinar on algorithmic trading for technocrats!Quant insti webinar on algorithmic trading for technocrats!
Quant insti webinar on algorithmic trading for technocrats!QuantInsti
 
Volatility Trading - Hedge Fund Strategies
Volatility Trading - Hedge Fund StrategiesVolatility Trading - Hedge Fund Strategies
Volatility Trading - Hedge Fund StrategiesHedge Fund South Africa
 
How to use VWAP as an important technical indicator
How to use VWAP as an important technical indicator How to use VWAP as an important technical indicator
How to use VWAP as an important technical indicator Mike Bellafiore
 
Playbook exercise RHT
Playbook exercise RHT Playbook exercise RHT
Playbook exercise RHT smbcapital
 
为啥别读HotSpot VM的源码(2012-03-03)
为啥别读HotSpot VM的源码(2012-03-03)为啥别读HotSpot VM的源码(2012-03-03)
为啥别读HotSpot VM的源码(2012-03-03)Kris Mok
 
Managing an Option Portfolio and how Automated Trading makes it easier
Managing an Option Portfolio and how Automated Trading makes it easierManaging an Option Portfolio and how Automated Trading makes it easier
Managing an Option Portfolio and how Automated Trading makes it easierQuantInsti
 
"From Trading Strategy to Becoming an Industry Professional – How to Break in...
"From Trading Strategy to Becoming an Industry Professional – How to Break in..."From Trading Strategy to Becoming an Industry Professional – How to Break in...
"From Trading Strategy to Becoming an Industry Professional – How to Break in...Quantopian
 
Beware of Low Frequency Data by Ernie Chan, Managing Member, QTS Capital Mana...
Beware of Low Frequency Data by Ernie Chan, Managing Member, QTS Capital Mana...Beware of Low Frequency Data by Ernie Chan, Managing Member, QTS Capital Mana...
Beware of Low Frequency Data by Ernie Chan, Managing Member, QTS Capital Mana...Quantopian
 
"From Alpha Discovery to Portfolio Construction: Pitfalls and Solutions" by D...
"From Alpha Discovery to Portfolio Construction: Pitfalls and Solutions" by D..."From Alpha Discovery to Portfolio Construction: Pitfalls and Solutions" by D...
"From Alpha Discovery to Portfolio Construction: Pitfalls and Solutions" by D...Quantopian
 
Formation trading
Formation tradingFormation trading
Formation tradingAlicebkl
 
Combining the Best Stock Selection Factors by Patrick O'Shaughnessy at QuantC...
Combining the Best Stock Selection Factors by Patrick O'Shaughnessy at QuantC...Combining the Best Stock Selection Factors by Patrick O'Shaughnessy at QuantC...
Combining the Best Stock Selection Factors by Patrick O'Shaughnessy at QuantC...Quantopian
 
Should You Build Your Own Backtester? by Michael Halls-Moore at QuantCon 2016
Should You Build Your Own Backtester? by Michael Halls-Moore at QuantCon 2016Should You Build Your Own Backtester? by Michael Halls-Moore at QuantCon 2016
Should You Build Your Own Backtester? by Michael Halls-Moore at QuantCon 2016Quantopian
 
Being open (source) in the traditionally secretive field of quant finance.
Being open (source) in the traditionally secretive field of quant finance.Being open (source) in the traditionally secretive field of quant finance.
Being open (source) in the traditionally secretive field of quant finance.Quantopian
 
Automated Selection and Robustness for Systematic Trading Strategies by Dr. T...
Automated Selection and Robustness for Systematic Trading Strategies by Dr. T...Automated Selection and Robustness for Systematic Trading Strategies by Dr. T...
Automated Selection and Robustness for Systematic Trading Strategies by Dr. T...Quantopian
 
Race condition
Race conditionRace condition
Race conditionhama7230
 
Forex Trading For Beginners (2019) - The Holy Grail Of Trading
Forex Trading For Beginners (2019) - The Holy Grail Of TradingForex Trading For Beginners (2019) - The Holy Grail Of Trading
Forex Trading For Beginners (2019) - The Holy Grail Of TradingRoberts Eihmanis
 

What's hot (20)

Webinar: You Trade Like a Girl with Mike Bellafiore and Anne-Marie Baiynd
Webinar: You Trade Like a Girl with Mike Bellafiore and Anne-Marie BaiyndWebinar: You Trade Like a Girl with Mike Bellafiore and Anne-Marie Baiynd
Webinar: You Trade Like a Girl with Mike Bellafiore and Anne-Marie Baiynd
 
"Fundamental Forecasts: Methods and Timing" by Vinesh Jha, CEO of ExtractAlpha
"Fundamental Forecasts: Methods and Timing" by Vinesh Jha, CEO of ExtractAlpha"Fundamental Forecasts: Methods and Timing" by Vinesh Jha, CEO of ExtractAlpha
"Fundamental Forecasts: Methods and Timing" by Vinesh Jha, CEO of ExtractAlpha
 
From new trader to great
From new trader to greatFrom new trader to great
From new trader to great
 
Quant insti webinar on algorithmic trading for technocrats!
Quant insti webinar on algorithmic trading for technocrats!Quant insti webinar on algorithmic trading for technocrats!
Quant insti webinar on algorithmic trading for technocrats!
 
Volatility Trading - Hedge Fund Strategies
Volatility Trading - Hedge Fund StrategiesVolatility Trading - Hedge Fund Strategies
Volatility Trading - Hedge Fund Strategies
 
How to use VWAP as an important technical indicator
How to use VWAP as an important technical indicator How to use VWAP as an important technical indicator
How to use VWAP as an important technical indicator
 
Playbook exercise RHT
Playbook exercise RHT Playbook exercise RHT
Playbook exercise RHT
 
为啥别读HotSpot VM的源码(2012-03-03)
为啥别读HotSpot VM的源码(2012-03-03)为啥别读HotSpot VM的源码(2012-03-03)
为啥别读HotSpot VM的源码(2012-03-03)
 
Managing an Option Portfolio and how Automated Trading makes it easier
Managing an Option Portfolio and how Automated Trading makes it easierManaging an Option Portfolio and how Automated Trading makes it easier
Managing an Option Portfolio and how Automated Trading makes it easier
 
"From Trading Strategy to Becoming an Industry Professional – How to Break in...
"From Trading Strategy to Becoming an Industry Professional – How to Break in..."From Trading Strategy to Becoming an Industry Professional – How to Break in...
"From Trading Strategy to Becoming an Industry Professional – How to Break in...
 
Beware of Low Frequency Data by Ernie Chan, Managing Member, QTS Capital Mana...
Beware of Low Frequency Data by Ernie Chan, Managing Member, QTS Capital Mana...Beware of Low Frequency Data by Ernie Chan, Managing Member, QTS Capital Mana...
Beware of Low Frequency Data by Ernie Chan, Managing Member, QTS Capital Mana...
 
"From Alpha Discovery to Portfolio Construction: Pitfalls and Solutions" by D...
"From Alpha Discovery to Portfolio Construction: Pitfalls and Solutions" by D..."From Alpha Discovery to Portfolio Construction: Pitfalls and Solutions" by D...
"From Alpha Discovery to Portfolio Construction: Pitfalls and Solutions" by D...
 
Formation trading
Formation tradingFormation trading
Formation trading
 
Combining the Best Stock Selection Factors by Patrick O'Shaughnessy at QuantC...
Combining the Best Stock Selection Factors by Patrick O'Shaughnessy at QuantC...Combining the Best Stock Selection Factors by Patrick O'Shaughnessy at QuantC...
Combining the Best Stock Selection Factors by Patrick O'Shaughnessy at QuantC...
 
Should You Build Your Own Backtester? by Michael Halls-Moore at QuantCon 2016
Should You Build Your Own Backtester? by Michael Halls-Moore at QuantCon 2016Should You Build Your Own Backtester? by Michael Halls-Moore at QuantCon 2016
Should You Build Your Own Backtester? by Michael Halls-Moore at QuantCon 2016
 
Being open (source) in the traditionally secretive field of quant finance.
Being open (source) in the traditionally secretive field of quant finance.Being open (source) in the traditionally secretive field of quant finance.
Being open (source) in the traditionally secretive field of quant finance.
 
Automated Selection and Robustness for Systematic Trading Strategies by Dr. T...
Automated Selection and Robustness for Systematic Trading Strategies by Dr. T...Automated Selection and Robustness for Systematic Trading Strategies by Dr. T...
Automated Selection and Robustness for Systematic Trading Strategies by Dr. T...
 
Race condition
Race conditionRace condition
Race condition
 
abc027
abc027abc027
abc027
 
Forex Trading For Beginners (2019) - The Holy Grail Of Trading
Forex Trading For Beginners (2019) - The Holy Grail Of TradingForex Trading For Beginners (2019) - The Holy Grail Of Trading
Forex Trading For Beginners (2019) - The Holy Grail Of Trading
 

Viewers also liked

Understand Foreign Equity in AmiBroker
Understand Foreign Equity in AmiBrokerUnderstand Foreign Equity in AmiBroker
Understand Foreign Equity in AmiBrokerThaiQuants
 
AmiBroker AFL to DLL Conversion
AmiBroker  AFL to DLL ConversionAmiBroker  AFL to DLL Conversion
AmiBroker AFL to DLL Conversionafl2dll
 
Coimbatore amibroker workshop 2014
Coimbatore amibroker workshop 2014Coimbatore amibroker workshop 2014
Coimbatore amibroker workshop 2014Marketcalls
 
AmiBroker Buy sell target & stop loss trading signals software for equity, co...
AmiBroker Buy sell target & stop loss trading signals software for equity, co...AmiBroker Buy sell target & stop loss trading signals software for equity, co...
AmiBroker Buy sell target & stop loss trading signals software for equity, co...Vishnu Kumar
 
Amibroker AFL Coding - Webinar
Amibroker AFL Coding - WebinarAmibroker AFL Coding - Webinar
Amibroker AFL Coding - WebinarMarketcalls
 
Monte Carlo Simulations & Membrane Simulation and Dynamics
Monte Carlo Simulations & Membrane Simulation and DynamicsMonte Carlo Simulations & Membrane Simulation and Dynamics
Monte Carlo Simulations & Membrane Simulation and DynamicsArindam Ghosh
 
Amibroker afl coding 28th atma bengaluru meet
Amibroker afl coding   28th atma bengaluru meetAmibroker afl coding   28th atma bengaluru meet
Amibroker afl coding 28th atma bengaluru meetMarketcalls
 
TradeZilla - Trading system Design
TradeZilla - Trading system DesignTradeZilla - Trading system Design
TradeZilla - Trading system DesignMarketcalls
 
Trading System Design
Trading System DesignTrading System Design
Trading System DesignMarketcalls
 
Selection Rotation Charts / Stats / Trades
Selection Rotation Charts / Stats / TradesSelection Rotation Charts / Stats / Trades
Selection Rotation Charts / Stats / TradesJason Unger
 
Improving Your Trading Plan
Improving Your Trading PlanImproving Your Trading Plan
Improving Your Trading PlanBenjamin Cheeks
 
Limiti del modello Black-Scholes-Merton e vantaggi del metodo Monte Carlo: an...
Limiti del modello Black-Scholes-Merton e vantaggi del metodo Monte Carlo: an...Limiti del modello Black-Scholes-Merton e vantaggi del metodo Monte Carlo: an...
Limiti del modello Black-Scholes-Merton e vantaggi del metodo Monte Carlo: an...Matteo Evangelisti
 
Introduzione al metodo monte carlo
Introduzione al metodo monte carloIntroduzione al metodo monte carlo
Introduzione al metodo monte carloGiovanni Della Lunga
 
Plan your trade,trade your plan
Plan your trade,trade your planPlan your trade,trade your plan
Plan your trade,trade your planandy6898
 
Risk management - Avvocato del diavolo
Risk management - Avvocato del diavoloRisk management - Avvocato del diavolo
Risk management - Avvocato del diavoloManager.it
 
Transition to a_hedge fund_-_wsi
Transition to a_hedge fund_-_wsiTransition to a_hedge fund_-_wsi
Transition to a_hedge fund_-_wsikevinWSI
 
A Guide to Trading System Analysis : แนะนำแนวทางการอ่านผล Backtest เพื่อวิเคร...
A Guide to Trading System Analysis : แนะนำแนวทางการอ่านผล Backtest เพื่อวิเคร...A Guide to Trading System Analysis : แนะนำแนวทางการอ่านผล Backtest เพื่อวิเคร...
A Guide to Trading System Analysis : แนะนำแนวทางการอ่านผล Backtest เพื่อวิเคร...siamquant
 

Viewers also liked (20)

Understand Foreign Equity in AmiBroker
Understand Foreign Equity in AmiBrokerUnderstand Foreign Equity in AmiBroker
Understand Foreign Equity in AmiBroker
 
AmiBroker AFL to DLL Conversion
AmiBroker  AFL to DLL ConversionAmiBroker  AFL to DLL Conversion
AmiBroker AFL to DLL Conversion
 
Coimbatore amibroker workshop 2014
Coimbatore amibroker workshop 2014Coimbatore amibroker workshop 2014
Coimbatore amibroker workshop 2014
 
AmiBroker Buy sell target & stop loss trading signals software for equity, co...
AmiBroker Buy sell target & stop loss trading signals software for equity, co...AmiBroker Buy sell target & stop loss trading signals software for equity, co...
AmiBroker Buy sell target & stop loss trading signals software for equity, co...
 
Amibroker AFL Coding - Webinar
Amibroker AFL Coding - WebinarAmibroker AFL Coding - Webinar
Amibroker AFL Coding - Webinar
 
Monte Carlo Simulations & Membrane Simulation and Dynamics
Monte Carlo Simulations & Membrane Simulation and DynamicsMonte Carlo Simulations & Membrane Simulation and Dynamics
Monte Carlo Simulations & Membrane Simulation and Dynamics
 
Amibroker afl coding 28th atma bengaluru meet
Amibroker afl coding   28th atma bengaluru meetAmibroker afl coding   28th atma bengaluru meet
Amibroker afl coding 28th atma bengaluru meet
 
TradeZilla - Trading system Design
TradeZilla - Trading system DesignTradeZilla - Trading system Design
TradeZilla - Trading system Design
 
Trading System Design
Trading System DesignTrading System Design
Trading System Design
 
Selection Rotation Charts / Stats / Trades
Selection Rotation Charts / Stats / TradesSelection Rotation Charts / Stats / Trades
Selection Rotation Charts / Stats / Trades
 
Stock trader types
Stock trader typesStock trader types
Stock trader types
 
Improving Your Trading Plan
Improving Your Trading PlanImproving Your Trading Plan
Improving Your Trading Plan
 
Limiti del modello Black-Scholes-Merton e vantaggi del metodo Monte Carlo: an...
Limiti del modello Black-Scholes-Merton e vantaggi del metodo Monte Carlo: an...Limiti del modello Black-Scholes-Merton e vantaggi del metodo Monte Carlo: an...
Limiti del modello Black-Scholes-Merton e vantaggi del metodo Monte Carlo: an...
 
Introduzione al metodo monte carlo
Introduzione al metodo monte carloIntroduzione al metodo monte carlo
Introduzione al metodo monte carlo
 
Plan your trade,trade your plan
Plan your trade,trade your planPlan your trade,trade your plan
Plan your trade,trade your plan
 
Risk management - Avvocato del diavolo
Risk management - Avvocato del diavoloRisk management - Avvocato del diavolo
Risk management - Avvocato del diavolo
 
Trading system designer
Trading system designerTrading system designer
Trading system designer
 
Td sequential2
Td sequential2Td sequential2
Td sequential2
 
Transition to a_hedge fund_-_wsi
Transition to a_hedge fund_-_wsiTransition to a_hedge fund_-_wsi
Transition to a_hedge fund_-_wsi
 
A Guide to Trading System Analysis : แนะนำแนวทางการอ่านผล Backtest เพื่อวิเคร...
A Guide to Trading System Analysis : แนะนำแนวทางการอ่านผล Backtest เพื่อวิเคร...A Guide to Trading System Analysis : แนะนำแนวทางการอ่านผล Backtest เพื่อวิเคร...
A Guide to Trading System Analysis : แนะนำแนวทางการอ่านผล Backtest เพื่อวิเคร...
 

Similar to Monte Carlo Simulation for Trading System in AmiBroker

"A Framework for Developing Trading Models Based on Machine Learning" by Kris...
"A Framework for Developing Trading Models Based on Machine Learning" by Kris..."A Framework for Developing Trading Models Based on Machine Learning" by Kris...
"A Framework for Developing Trading Models Based on Machine Learning" by Kris...Quantopian
 
QBA Simulation and Inventory.pptx
QBA Simulation and Inventory.pptxQBA Simulation and Inventory.pptx
QBA Simulation and Inventory.pptxArthurRanola
 
Stochastic Loss Reserving-General Insurance
Stochastic Loss Reserving-General InsuranceStochastic Loss Reserving-General Insurance
Stochastic Loss Reserving-General InsuranceSyed Danish Ali
 
Algo trading(Minor Project) strategy EMA with Ipython
Algo trading(Minor Project) strategy EMA with IpythonAlgo trading(Minor Project) strategy EMA with Ipython
Algo trading(Minor Project) strategy EMA with IpythonDeb prakash ganguly
 
Modelling with simulation
Modelling with simulation Modelling with simulation
Modelling with simulation Jessica Aldea
 
Quant studio expert
Quant studio expertQuant studio expert
Quant studio expertVishal Doshi
 
What's New in the Timeseries Toolkit for IBM InfoSphere Streams V4.0
What's New in the Timeseries Toolkit for IBM InfoSphere Streams V4.0What's New in the Timeseries Toolkit for IBM InfoSphere Streams V4.0
What's New in the Timeseries Toolkit for IBM InfoSphere Streams V4.0lisanl
 
Presentation (2).pptx
Presentation (2).pptxPresentation (2).pptx
Presentation (2).pptxPunitTewani2
 
Capital Cube- Contextual Treasury fueled by Composable NextGen Tech
Capital Cube- Contextual Treasury fueled by Composable NextGen TechCapital Cube- Contextual Treasury fueled by Composable NextGen Tech
Capital Cube- Contextual Treasury fueled by Composable NextGen TechIntellect Design Arena .
 
Predictive Model for Customer Segmentation using Database Marketing Techniques
Predictive Model for Customer Segmentation using Database Marketing TechniquesPredictive Model for Customer Segmentation using Database Marketing Techniques
Predictive Model for Customer Segmentation using Database Marketing TechniquesAkanksha Jain
 
An Introduction to RFM in Analytics
An Introduction to RFM in AnalyticsAn Introduction to RFM in Analytics
An Introduction to RFM in AnalyticsSAS Canada
 
Simulation Techniques
Simulation TechniquesSimulation Techniques
Simulation Techniquesmailrenuka
 
AmiBroker Xtreme Course, ABXC
AmiBroker Xtreme Course, ABXCAmiBroker Xtreme Course, ABXC
AmiBroker Xtreme Course, ABXCThaiQuants
 
Sales force automation - Part 3
Sales force automation - Part 3Sales force automation - Part 3
Sales force automation - Part 3Naveen Kumar
 
Stochastic Modeling - Financial Reporting
Stochastic Modeling - Financial ReportingStochastic Modeling - Financial Reporting
Stochastic Modeling - Financial ReportingRon Harasym
 

Similar to Monte Carlo Simulation for Trading System in AmiBroker (20)

"A Framework for Developing Trading Models Based on Machine Learning" by Kris...
"A Framework for Developing Trading Models Based on Machine Learning" by Kris..."A Framework for Developing Trading Models Based on Machine Learning" by Kris...
"A Framework for Developing Trading Models Based on Machine Learning" by Kris...
 
QBA Simulation and Inventory.pptx
QBA Simulation and Inventory.pptxQBA Simulation and Inventory.pptx
QBA Simulation and Inventory.pptx
 
When Should I Use Simulation?
When Should I Use Simulation?When Should I Use Simulation?
When Should I Use Simulation?
 
Stochastic Loss Reserving-General Insurance
Stochastic Loss Reserving-General InsuranceStochastic Loss Reserving-General Insurance
Stochastic Loss Reserving-General Insurance
 
Algo trading(Minor Project) strategy EMA with Ipython
Algo trading(Minor Project) strategy EMA with IpythonAlgo trading(Minor Project) strategy EMA with Ipython
Algo trading(Minor Project) strategy EMA with Ipython
 
When Should I use Simulation?
When Should I use Simulation?When Should I use Simulation?
When Should I use Simulation?
 
Modelling with simulation
Modelling with simulation Modelling with simulation
Modelling with simulation
 
Quant studio expert
Quant studio expertQuant studio expert
Quant studio expert
 
XVA, The Front Office Way
XVA, The Front Office WayXVA, The Front Office Way
XVA, The Front Office Way
 
What's New in the Timeseries Toolkit for IBM InfoSphere Streams V4.0
What's New in the Timeseries Toolkit for IBM InfoSphere Streams V4.0What's New in the Timeseries Toolkit for IBM InfoSphere Streams V4.0
What's New in the Timeseries Toolkit for IBM InfoSphere Streams V4.0
 
Presentation (2).pptx
Presentation (2).pptxPresentation (2).pptx
Presentation (2).pptx
 
Capital Cube- Contextual Treasury fueled by Composable NextGen Tech
Capital Cube- Contextual Treasury fueled by Composable NextGen TechCapital Cube- Contextual Treasury fueled by Composable NextGen Tech
Capital Cube- Contextual Treasury fueled by Composable NextGen Tech
 
Predictive Model for Customer Segmentation using Database Marketing Techniques
Predictive Model for Customer Segmentation using Database Marketing TechniquesPredictive Model for Customer Segmentation using Database Marketing Techniques
Predictive Model for Customer Segmentation using Database Marketing Techniques
 
An Introduction to RFM in Analytics
An Introduction to RFM in AnalyticsAn Introduction to RFM in Analytics
An Introduction to RFM in Analytics
 
Simulation Techniques
Simulation TechniquesSimulation Techniques
Simulation Techniques
 
AmiBroker Xtreme Course, ABXC
AmiBroker Xtreme Course, ABXCAmiBroker Xtreme Course, ABXC
AmiBroker Xtreme Course, ABXC
 
Sales force automation - Part 3
Sales force automation - Part 3Sales force automation - Part 3
Sales force automation - Part 3
 
Deep learning in algorithmic trading
Deep learning in algorithmic tradingDeep learning in algorithmic trading
Deep learning in algorithmic trading
 
Cbsam user manual
Cbsam user manualCbsam user manual
Cbsam user manual
 
Stochastic Modeling - Financial Reporting
Stochastic Modeling - Financial ReportingStochastic Modeling - Financial Reporting
Stochastic Modeling - Financial Reporting
 

Recently uploaded

REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 

Recently uploaded (20)

REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 

Monte Carlo Simulation for Trading System in AmiBroker

  • 2. Whyperform Monte Carlo Simulation? •Probability of Risk & Reward •Worst Scenarios of Risk & Reward •Strategy Robustness 2
  • 3. Whatis Monte Carlo Simulation? Random Sampling Calculate Statistics 3
  • 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
  • 7. Trade Shuffling (AmiBroker’s feature) Trade Simulating (User’s code) 2 TYPES OF MC SIMULATION 7
  • 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
  • 13. Testing from start2011 – end2014 13
  • 14. Trade Shuffling MC Results 14
  • 15. Monte Carlo Simulation Template “Trade Simulating” AMIBROKER QUANT COURSE 15
  • 16. Code for Trade Simulating Simulation •Slippage •Missing Trades •Partially Filled Orders •Additional Noise 16