Monte Carlo Simulation in AmiBroker

Monte Carlo Simulation in AmiBroker เป็นการสุ่มค่าแบบต่างๆเพื่อทำการจำลองระบบการซื้อขายหุ้น และคำนวนค่าความน่าจะเป็นของค่าต่างๆเช่น CAR และ MDD ซึ่งการทำ Simulation ใน AmiBroker สามารถแบ่งออกได้หลักๆ 2 ประเภท คือ แบบสุ่มลำดับการเทรด Trade Shuffling (AmiBroker’s Built-in Feature) และแบบสุ่มค่าตัวเลข Trade Modeling (User’s code)

เพื่อให้เข้าใจถึงเหตุผลและความจำเป็นในการใช้ Monte Carlo Simulation in Trading System โดยเฉพาะใน โปรแกรม AmiBroker ผมขอเกริ่นนำคร่าวๆดังนี้

Why do we perform Monte Carlo Simulation? (ทำไมต้องทำ Simulation ในการทดสอบระบบ)

  • Probability of Risk & Reward
  • Worst Scenarios
  • Strategy Robustness

What is Monte Carlo Simulation? (อะไรคือ Simulation)

  • Random Sampling (การสุ่มค่าต่างๆ เช่น Slippage & Missing Trades)
  • Calculate Statistical Parameters: CAR, MDD, … (การวิเคราะห์ทางสถิติจากผลของการสุ่ม)

How many types of Monte Carlo Simulation in AmiBroker? (มีการทำ Simulation กี่แบบใน AmiBroker)

  1. Trade Shuffling, AmiBroker’s Built-in Feature (Simulation แบบสลับลำดับการเทรด)
  2. Trade Modeling (or Trade Simulating), User’s code (Simulation แบบจำลองการเทรด)

วีดีโอสำหรับ Monte Carlo Simulation

หมายเหตุ: วีดีโอชุดนี้เป็นส่วนหนึ่งของ AmiBroker Quant Course ในส่วนของ 02 Coding Template->06 Simulation

วีดีโอสำหรับ Two Types of MC Simulation in AmiBroker

Monte Carlo Simulation in AmiBroker Trade Shuffling

Advantages of Trade Shuffling (ข้อดีของ Simulation แบบสลับลำดับการเทรด)

  • Ready to use (AmiBroker’s built-in feature) ใช้ง่าย AmiBroker ทำให้หมด
  • Provide necessary basic statistical parameters มีข้อมูลเบื้องต้นให้
  • Fast รวดเร็ว
  • Suitable for new traders and testing process เหมาะสำหรับมือใหม่

Disadvantages of Trade Shuffling (ข้อเสียของ Simulation แบบสลับลำดับการเทรด)

  • Assumptions of independent trades ความถูกต้องขึ้นกับเงื่อนไขความอิสระของการเทรด
  • Simulation results derived from only one trade list ผลที่ได้มาจากแค่ 1 trade list เท่านั้น
  • Limited position sizing methods จำกัดรูปแบบการวิเคราะห์การบริหารเงิน
  • Missing various important statistical parameters ค่าทางสถิติหลายตัวไม่ได้ถูกนำมาแสดง

Advantages of Trade Modeling (ข้อดีของ Simulation แบบจำลองการเทรด)

  • User controls all aspects of simulation model. ผู้ออกแบบระบบควบคุมแบบจำลองอย่างละเอียด
  • User can perform sensitivity analysis. สามารถต่อยอดการวิเคราะห์ออกไปยัง Sensitivity Analysis
  • Results can be very close to actual trading. ผลลัพธ์ที่ได้สามารถทำให้ใกล้เคียงการเทรดจริง
  • Assumptions by user can be used to monitor actual trading. สมมุติฐานสามารถนำไปใช้ในการควบคุมการเทรดจริง

Disadvantages of Trade Modeling (ข้อเสียของ Simulation แบบจำลองการเทรด)

  • User’s assumptions could be wrong: percent of slippage, percent of missing trades, … สมมุติฐานที่ตั้งโดยผู้ออกแบบระบบอาจจะถูกหรือผิดก็ได้
  • Not ready to use. User must code his/her assumptions into the code. ผู้ใช้ต้องตั้งสมมุติฐานต่างๆและเขียนโค้ดเอง AmiBroker ไม่มีให้แบบสำเร็จรูป
  • Slow. Take times to run many backtests. ใช้เวลานานในการทดสอบ Backtest
  • User must manually calculate statistical parameters. ผู้ใช้ต้องทำการคำนวณทางสถิติเองหลังที่ได้ผลลัพธ์จากการทดสอบ Backtest

เพิ่มเติม Monte Carlo Simulation in AmiBroker