feat/alamo-hedge · 2026-05-14 07:58 · verified across Feb 18-26 + Mar 18-26 backtests
Trang này chứng minh code FBotAlamo.mqh v3 đã implement đúng toàn bộ luồng
theo spec chốt 2026-05-12 23:57 (preview link).
Mỗi rule kèm verbatim log line từ backtest 8 ngày để verify. Sau đó Hotfix1
(PosManCloseAlamo) đã fix bug orphan Ln — xem section dưới.
🔧 HOTFIX3 — LotSnowball (2026-05-14 07:58) LATEST
Lot snowball FIXED + fire cooldown thêm vào
Bug 4 (lot snowball): L_(n+1) lot bao gồm cả lot của L_n. Filter AlamoSum2CondLots dùng prevLn động → mỗi tầng cutoff giá dịch theo → bao thêm grid orders mới VÀ giữ lại tất cả grid cũ. Feb 23 thấy snowball 13.76 → 13.76 → 25.16 → 44.85 × 3 (6 tầng/2s).
Root cause: Spec prototype quy định 2-cond filter "relative to L1" (cố định) nhưng code dùng g_alamoTickets[ArraySize-1] = Ln gần nhất (động).
Fix: Đổi anchor sang g_alamoTickets[0] = L1 fixed. Mỗi tầng L2/L3/Ln+ tính lot theo grid losers relative to L1 — không phụ thuộc Ln-1 → không snowball.
Bonus fix: Thêm input AlamoFireCooldownSec = 10 chống khai hỏa loạn L3/L4/L5 cùng tick khi DD spike đột ngột.
Before / After lot scaling (cùng dataset, Feb 23 + Mar 19)
Window
L1 lot
L2 lot
L3 lot
L4-L6
Status
Feb 23 — PRE Hotfix3
13.76
13.76
25.16
44.85 × 3
❌ snowball + spam
Feb 23 — POST Hotfix3
13.76
13.76
13.76
— DD chưa đạt 40%
✅ flat, no spam
Mar 19 — PRE Hotfix3
13.57
13.57
24.76
— DD chưa đạt 40%
❌ snowball start
Mar 19 — POST Hotfix3
13.57
13.57
13.57
— DD chưa đạt 40%
✅ flat
H3.1Lot anchored to L1 (no snowball)VERIFIED
Expected: L2, L3, L_n+ lot = sum grid losers relative to L1 fixed (không phải prevLn). Mỗi tầng cho ra cùng giá trị 2cond_lots ≈ grid loser tại L1 time.
2cond_lots giữ nguyên 13.76 (Feb) / 13.57 (Mar) từ L1 → L2 → L3. Field anchor=L1(ticket) confirm filter dùng L1 cố định. Pre-Hotfix3 L3 lot lần lượt 25.16 và 24.76.
2 marker mới giúp confirm config trực tiếp từ log. Cooldown configurable qua input AlamoFireCooldownSec.
H3.3L4+ stable by code (chưa có log evidence trong dataset)CODE-VERIFIED
Limitation: Dataset Feb 18-26 + Mar 18-26 DD không vượt 40% nên không có L4+ fire trong log. L4+ stability verified bằng inspect code path.
Code path — FBotAlamo.mqh:541
// Hotfix3: anchor 2-cond filter at L1 (fixed) per prototype spec
ulong l1Ticket = g_alamoTickets[0];
double lotSum = AlamoSum2CondLots(l1Ticket); // ALWAYS anchored L1, không phụ thuộc N
Cùng công thức cho mọi N → L4, L5, L6, L_N+ đều cho lot tương đương L2/L3. Cần backtest scenario DD spike >40% để có log evidence cứng cho L4+.
🔧 HOTFIX2 — L2L3Fire (2026-05-13 23:12)
2 bugs FIXED: gate location + scaling
Bug 2 (gate location): Em đặt 3-order gate sai chỗ ở v3 — block FIRE L2 thay vì gate CLOSE L1. Spec ý (Max 21:37): "≥3 lệnh trên Ln → PosMan đóng" = gate ở CLOSE.
Bug 3 (gate scaling): L3+ fire gate stuck at 30% (escMult hard-code = 3.0). Spec note: L_N fires khi DD ≥ N×Thr → L1=10%, L2=20%, L3=30%, L4=40%, L5=50%, L6=60%.
2 input dead code đã xoá. Init log self-documenting công thức gate.
🔧 HOTFIX1 — PosManCloseAlamo (2026-05-13 22:24)
Bug FIXED + profit reversal $-220k → +$75k
Bug: Khi close-all triggered từ Skill 6 / Skill 4 / GridManager / Schedule, redundancy trigger (Addendum 1) không fire → ALAMO Ln orphan ~11 giờ trước khi cleanup end-of-test.
Root cause: 5 path close-all không gọi AlamoCloseAll(). BulkCloseAllAsync filter magic 123456 (grid) → ALAMO magic 123458 escape.