รีวิว Python for Strategy Backtesting — Investic

Part 3: Python เพื่อการลงทุน

Donato_TH
Donato Story
2 min readMar 12, 2023

--

If you are interested in articles related to my experience, please feel free to contact me: linkedin.com/in/nattapong-thanngam

Course Outline

จาก “Python for Technical Analysis” มาต่อด้วย “Python for Strategy Backtesting” ที่มีเนื้อหาคราวๆดังนี้

  • การทำ Back test overview
  • ตั้ง Stop Loss, Take Profit, Slippage และ Fees
  • การทำ Back test หลาย Indicator และ Condition ที่ซับซ้อนขึ้น

Example Output:

ผมเลือก หุ้นบางจาก (BCP.BK) มาใช้ในการเขียน Code ตามเนื้อหาที่เรียนนะครับ

  • ตัวอย่างการทำ Back Test Overview
    ภาพด้านล่างเป็นตัวอย่างการใช้ MACD เพื่อเป็น Indicator ในการ Trend
    - กราฟบน: กราฟแสดงสัญญาการลงทุน (ผมได้สร้างวงกลมสีดำไว้ 2 อัน)
    - กราฟกลาง: กราฟแสดง Return (จาก Action ที่วงสีดำ ได้กำไร 9.34%)
    - กราฟล่าง: กราฟเปรียบเทียบ A “การซื้อแล้วถือ” กับ B “การ Trend ตาม Signal” ผลคือการ Trend ตาม Signal นี้แพ้การซื้อแล้วถือ (case study only)
ตัวอย่างกราฟที่ได้จากคอร์ส Strategy Backtesting — 1
  • ยังสามารถแสดงรายละเอียดในรูปแบบต่างๆได้อีก อาทิ
ตัวอย่างกราฟที่ได้จากคอร์ส Strategy Backtesting — 2
ตัวอย่างกราฟที่ได้จากคอร์ส Strategy Backtesting — 3
ตัวอย่างข้อมูลที่ได้จากคอร์ส Strategy Backtesting — 1
  • นอกจากนี้ ยังมีการสอน Back test แบบหลาย Indicator อาทิ (RSI+MACD, MA+RSI), การ Stop loss, Set target price, การแบ่งไม้ Trend, การเล่นแบบ Short, การเล่น 2 Direction เป็นต้น แต่ทุกรูปแบบจะแสดงผลเหมือนกราฟด้านบน

My opinion:

  • เนื้อหาดี สามารถนำไปต่อยอดได ้(หา Indicator ที่เหมาะสม)
  • ใน Code ไม่ได้มีการสอน Indicator ที่ทาง Investic คิดค้นขึ้นนะครับ (High Performance Indicator) เป็นการสอนพื้นฐานการผสม Indicator เท่านั้น
    ใครอยากได้ Indicator ดีๆ เรียนจบแล้ว ต้องหาเองนะ ^__^
  • เนื้อหาหลายๆส่วน ไม่มีการให้ Code นะครับ พิมตามเสียเวลาพอควร Y__Y

Please feel free to contact me, I am willing to share and exchange on topics related to Data Science and Supply Chain.
Facebook:
facebook.com/nattapong.thanngam
Linkedin:
linkedin.com/in/nattapong-thanngam

--

--

Donato_TH
Donato Story

Data Science Team Lead at Data Cafe, Project Manager (PMP #3563199), Black Belt-Lean Six Sigma certificate