SlideShare a Scribd company logo
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

Forex trading
Forex tradingForex trading
Forex trading
Harmanjit Singh
 
Fibonacci analysis
Fibonacci analysisFibonacci analysis
Fibonacci analysis
ypendharkar
 
Simple scalping secret strategy
Simple scalping secret strategySimple scalping secret strategy
Simple scalping secret strategy
Heri Valiant
 
Forex for beginner - how to get started in forex trading
Forex for beginner -  how to get started in forex tradingForex for beginner -  how to get started in forex trading
Forex for beginner - how to get started in forex trading
oly1
 
High Probability Trading Setups
High Probability Trading SetupsHigh Probability Trading Setups
High Probability Trading Setups
btrader
 
Secrets of Price Action Trading
Secrets of Price Action TradingSecrets of Price Action Trading
Secrets of Price Action Trading
Syrous Pejman
 
FOREX SCALPING STRATEGY
FOREX SCALPING STRATEGYFOREX SCALPING STRATEGY
FOREX SCALPING STRATEGY
OptionsTekkers
 
Using Triangles in Technical Analysis
Using Triangles  in Technical AnalysisUsing Triangles  in Technical Analysis
Using Triangles in Technical Analysis
Sangamèsh Ks
 
Simple trading strategy for beginners
Simple trading strategy for beginnersSimple trading strategy for beginners
Simple trading strategy for beginners
pipsumo traderfx
 
40 pip parabolic sar forex strategy (1)
40 pip parabolic sar forex strategy (1)40 pip parabolic sar forex strategy (1)
40 pip parabolic sar forex strategy (1)
pipsumo traderfx
 
AmiBroker Custom Backtester Interface
AmiBroker Custom Backtester InterfaceAmiBroker Custom Backtester Interface
AmiBroker Custom Backtester Interface
ThaiQuants
 
Trading edge for the forex market
Trading edge for the forex marketTrading edge for the forex market
Trading edge for the forex market
lcchong76
 
5 Day Trading Techniques
5 Day Trading Techniques5 Day Trading Techniques
5 Day Trading Techniques
Christine Argier
 
1min
1min1min
Oliver velez swing trading tactics
Oliver velez   swing trading tacticsOliver velez   swing trading tactics
Oliver velez swing trading tactics
Aislan Pereira
 
How To Trade Regular Divergence with MACD, RSI, Stochastics
How To Trade Regular Divergence with MACD, RSI, StochasticsHow To Trade Regular Divergence with MACD, RSI, Stochastics
How To Trade Regular Divergence with MACD, RSI, Stochastics
NetpicksTrading
 
"Quant Trading for a Living – Lessons from a Life in the Trenches" by Andreas...
"Quant Trading for a Living – Lessons from a Life in the Trenches" by Andreas..."Quant Trading for a Living – Lessons from a Life in the Trenches" by Andreas...
"Quant Trading for a Living – Lessons from a Life in the Trenches" by Andreas...
Quantopian
 
LINE - Super Stock in Play
LINE - Super Stock in PlayLINE - Super Stock in Play
LINE - Super Stock in Play
smbcapital
 
What are Key Chart Levels and How to Trade Them
What are Key Chart Levels and How to Trade ThemWhat are Key Chart Levels and How to Trade Them
What are Key Chart Levels and How to Trade Them
 My Trading Skills
 
P Opening Drive and Pullback - Jan 7, 2014
P Opening Drive and Pullback - Jan 7, 2014P Opening Drive and Pullback - Jan 7, 2014
P Opening Drive and Pullback - Jan 7, 2014
smbcapital
 

What's hot (20)

Forex trading
Forex tradingForex trading
Forex trading
 
Fibonacci analysis
Fibonacci analysisFibonacci analysis
Fibonacci analysis
 
Simple scalping secret strategy
Simple scalping secret strategySimple scalping secret strategy
Simple scalping secret strategy
 
Forex for beginner - how to get started in forex trading
Forex for beginner -  how to get started in forex tradingForex for beginner -  how to get started in forex trading
Forex for beginner - how to get started in forex trading
 
High Probability Trading Setups
High Probability Trading SetupsHigh Probability Trading Setups
High Probability Trading Setups
 
Secrets of Price Action Trading
Secrets of Price Action TradingSecrets of Price Action Trading
Secrets of Price Action Trading
 
FOREX SCALPING STRATEGY
FOREX SCALPING STRATEGYFOREX SCALPING STRATEGY
FOREX SCALPING STRATEGY
 
Using Triangles in Technical Analysis
Using Triangles  in Technical AnalysisUsing Triangles  in Technical Analysis
Using Triangles in Technical Analysis
 
Simple trading strategy for beginners
Simple trading strategy for beginnersSimple trading strategy for beginners
Simple trading strategy for beginners
 
40 pip parabolic sar forex strategy (1)
40 pip parabolic sar forex strategy (1)40 pip parabolic sar forex strategy (1)
40 pip parabolic sar forex strategy (1)
 
AmiBroker Custom Backtester Interface
AmiBroker Custom Backtester InterfaceAmiBroker Custom Backtester Interface
AmiBroker Custom Backtester Interface
 
Trading edge for the forex market
Trading edge for the forex marketTrading edge for the forex market
Trading edge for the forex market
 
5 Day Trading Techniques
5 Day Trading Techniques5 Day Trading Techniques
5 Day Trading Techniques
 
1min
1min1min
1min
 
Oliver velez swing trading tactics
Oliver velez   swing trading tacticsOliver velez   swing trading tactics
Oliver velez swing trading tactics
 
How To Trade Regular Divergence with MACD, RSI, Stochastics
How To Trade Regular Divergence with MACD, RSI, StochasticsHow To Trade Regular Divergence with MACD, RSI, Stochastics
How To Trade Regular Divergence with MACD, RSI, Stochastics
 
"Quant Trading for a Living – Lessons from a Life in the Trenches" by Andreas...
"Quant Trading for a Living – Lessons from a Life in the Trenches" by Andreas..."Quant Trading for a Living – Lessons from a Life in the Trenches" by Andreas...
"Quant Trading for a Living – Lessons from a Life in the Trenches" by Andreas...
 
LINE - Super Stock in Play
LINE - Super Stock in PlayLINE - Super Stock in Play
LINE - Super Stock in Play
 
What are Key Chart Levels and How to Trade Them
What are Key Chart Levels and How to Trade ThemWhat are Key Chart Levels and How to Trade Them
What are Key Chart Levels and How to Trade Them
 
P Opening Drive and Pullback - Jan 7, 2014
P Opening Drive and Pullback - Jan 7, 2014P Opening Drive and Pullback - Jan 7, 2014
P Opening Drive and Pullback - Jan 7, 2014
 

Viewers also liked

Understand Foreign Equity in AmiBroker
Understand Foreign Equity in AmiBrokerUnderstand Foreign Equity in AmiBroker
Understand Foreign Equity in AmiBroker
ThaiQuants
 
AmiBroker AFL to DLL Conversion
AmiBroker  AFL to DLL ConversionAmiBroker  AFL to DLL Conversion
AmiBroker AFL to DLL Conversion
afl2dll
 
Coimbatore amibroker workshop 2014
Coimbatore amibroker workshop 2014Coimbatore amibroker workshop 2014
Coimbatore amibroker workshop 2014
Marketcalls
 
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 - Webinar
Marketcalls
 
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
Arindam 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 meet
Marketcalls
 
TradeZilla - Trading system Design
TradeZilla - Trading system DesignTradeZilla - Trading system Design
TradeZilla - Trading system Design
Marketcalls
 
Trading System Design
Trading System DesignTrading System Design
Trading System Design
Marketcalls
 
Selection Rotation Charts / Stats / Trades
Selection Rotation Charts / Stats / TradesSelection Rotation Charts / Stats / Trades
Selection Rotation Charts / Stats / Trades
Jason Unger
 
Stock trader types
Stock trader typesStock trader types
Stock trader types
Hanna Oosterveen
 
Improving Your Trading Plan
Improving Your Trading PlanImproving Your Trading Plan
Improving Your Trading Plan
Benjamin 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 diavolo
Manager.it
 
Trading system designer
Trading system designerTrading system designer
Trading system designer
Rodrigo Sucupira
 
Td sequential2
Td sequential2Td sequential2
Td sequential2
Arpit Nanavati
 
Transition to a_hedge fund_-_wsi
Transition to a_hedge fund_-_wsiTransition to a_hedge fund_-_wsi
Transition to a_hedge fund_-_wsi
kevinWSI
 
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.pptx
ArthurRanola
 
When Should I Use Simulation?
When Should I Use Simulation?When Should I Use Simulation?
When Should I Use Simulation?
SIMUL8 Corporation
 
Stochastic Loss Reserving-General Insurance
Stochastic Loss Reserving-General InsuranceStochastic Loss Reserving-General Insurance
Stochastic Loss Reserving-General Insurance
Syed 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 Ipython
Deb prakash ganguly
 
When Should I use Simulation?
When Should I use Simulation?When Should I use Simulation?
When Should I use Simulation?
SIMUL8 Corporation
 
Modelling with simulation
Modelling with simulation Modelling with simulation
Modelling with simulation
Jessica Aldea
 
Quant studio expert
Quant studio expertQuant studio expert
Quant studio expert
Vishal Doshi
 
XVA, The Front Office Way
XVA, The Front Office WayXVA, The Front Office Way
XVA, The Front Office Way
Andrey Chirikhin
 
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
lisanl
 
Presentation (2).pptx
Presentation (2).pptxPresentation (2).pptx
Presentation (2).pptx
PunitTewani2
 
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
Intellect 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 Techniques
Akanksha Jain
 
An Introduction to RFM in Analytics
An Introduction to RFM in AnalyticsAn Introduction to RFM in Analytics
An Introduction to RFM in Analytics
SAS Canada
 
Simulation Techniques
Simulation TechniquesSimulation Techniques
Simulation Techniques
mailrenuka
 
AmiBroker Xtreme Course, ABXC
AmiBroker Xtreme Course, ABXCAmiBroker Xtreme Course, ABXC
AmiBroker Xtreme Course, ABXC
ThaiQuants
 
Sales force automation - Part 3
Sales force automation - Part 3Sales force automation - Part 3
Sales force automation - Part 3
Naveen Kumar
 
Deep learning in algorithmic trading
Deep learning in algorithmic tradingDeep learning in algorithmic trading
Deep learning in algorithmic trading
Vienna Data Science Group
 
Cbsam user manual
Cbsam user manualCbsam user manual
Cbsam user manual
Kundan Gupta
 
Stochastic Modeling - Financial Reporting
Stochastic Modeling - Financial ReportingStochastic Modeling - Financial Reporting
Stochastic Modeling - Financial Reporting
Ron 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

Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
simonomuemu
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5
sayalidalavi006
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 

Recently uploaded (20)

Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 

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