Version 2.0 2026.03.20
🔧 FIX 1 — ระบบตรวจ Spike ใหม่ / Spike Detection Overhaul
ภาษาไทย
ของเดิม reset ราคาอ้างอิงทุกครั้งที่ window หมดเวลา ทำให้ราคาที่เคลื่อนไหวสะสมช้าๆ ถูกนับเป็น spike ได้ ของใหม่แต่ละ window วัดจากราคา ณ จุดเริ่มต้นของ window นั้นเท่านั้น และมี flag triggered ป้องกันการยิง order ซ้ำในหน้าต่างเดียวกัน
English
The old version reset the reference price on every window expiry, allowing slow accumulated moves to falsely trigger. The new version measures movement strictly from the price at window open, and a triggered flag prevents double-firing within the same window.

🔧 FIX 2 — Partial Close จริง / Real Partial Close
ภาษาไทย
ของเดิม stepParts ใช้แค่คำนวณระดับ trailing SL เท่านั้น ไม่ได้ปิด position จริง ของใหม่เมื่อราคาถึงแต่ละ step จะเรียก PositionClosePartial() ปิด 1/N ของ volume จริงๆ และปล่อย lot สุดท้ายให้ TP/SL จัดการเอง
English
Previously stepParts only calculated the trailing SL level but never actually closed any volume. Now when each step is reached, PositionClosePartial() is called to close 1/N of the current volume, leaving the final piece for TP/SL to handle.

🔧 FIX 3 — Cache Environment Check / แคชการตรวจสภาพแวดล้อม
ภาษาไทย
ของเดิมเรียก TerminalInfoInteger, AccountInfoInteger, SymbolInfoInteger ซ้ำทุก tick ของใหม่เพิ่ม struct EnvCache เก็บผลไว้ 30 วินาที ลดภาระการเรียก API ซ้ำโดยไม่จำเป็น
English
The old version called TerminalInfoInteger, AccountInfoInteger, and SymbolInfoInteger on every single tick. The new version caches the result in an EnvCache struct for 30 seconds, significantly reducing unnecessary API calls.

🔧 FIX 4 — ตรวจ Pending Orders ด้วย / Pending Order Check Added
ภาษาไทย
ของเดิม ExistOpenSpikeOrders() ตรวจแค่ open positions ถ้า broker ตอบสนองช้าและ order ยังเป็น pending อยู่ EA อาจเปิด order ซ้ำได้ ของใหม่เพิ่ม loop ตรวจ OrdersTotal() ครอบคลุม pending orders ด้วย
English
The old ExistOpenSpikeOrders() only scanned open positions. If the broker was slow and an order was still pending, the EA could open a duplicate. The new version adds a second loop through OrdersTotal() to cover pending orders as well.

🔧 FIX 5 — จำกัดจำนวน Position สูงสุด / Max Positions Limit
ภาษาไทย
ของเดิมไม่มีการจำกัดจำนวน position เลย ถ้าใช้หลาย timeframe พร้อมกันหรือ cooldown หมดเร็ว positions จะสะสมได้ไม่จำกัด ของใหม่เพิ่ม InpMaxPositions (default 3) และฟังก์ชัน CountOpenPositions() ตรวจก่อนเปิดทุกครั้ง ใส่ 0 เพื่อปิด limit
English
The old version had no cap on concurrent positions. Running across multiple timeframes or fast cooldown cycles could accumulate unlimited exposure. The new version adds InpMaxPositions (default 3) with a CountOpenPositions() check before every entry. Set to 0 to disable the limit.