Hotfix4 chuyển ALAMO từ monolithic state machine sang per-Ln mini-module (L1...L10 độc lập), strip sạch main grid khỏi EA, và tinh chỉnh pre-fire offset 2.0% → 2.5%. Hotfix1/2/3 vẫn được preserve nguyên vẹn.
GUARD Main grid placement sau flag AlamoOnly=true (Scope A) — block placement, giữ infrastructure. Verified bug: 2,951 stray LOT_CALC/sell stop lines trong log Hotfix3 dù ArcherEnabled=false.
NEW Per-Ln mini-module — AlamoLevel g_levels[10] với state riêng từng level.
TWEAK Pre-fire offset 2.0% → 2.5% (SS spec).
NEW UI panel ALAMO tracker — replace "Phòng thủ Phản công".
KEEP Hotfix1 (PosMan redundancy), Hotfix2 (gate scale N×Thr), Hotfix3 (L1-fixed lot anchor), Smart Close, all includes & inputs.
| From | To | Trigger |
|---|---|---|
| IDLE | MONITOR | DD ≥ (N × L1Thr − 2.5%) AND Con1 all-âm |
| MONITOR | IDLE | Con1 broken OR DD < (N × L1Thr − 2.5%) |
| MONITOR | ACTIVE | DD ≥ N × L1Thr AND Con1 + cooldown OK → FIRE |
| ACTIVE | IDLE | Self-close (profit ≥ threshold) OR Combined close OR Redundancy CloseAll |
SS spec verbatim: "L2 vào S1 khi drawdown đạt (2x L1 − 2.5%), false return thì ngồi chơi, yes return thì bắt đầu đếm như cũ. >= 2x L1 thì S2 activate."
L1Thr = 10%, MaxLevels = 10, monOffset = 2.5%
struct AlamoLevel {
int idx; // 1..10
double fireThr; // N × L1Thr
double monThr; // fireThr − 2.5
ENUM state; // IDLE | MONITOR | ACTIVE
ulong ticket;
double lot;
datetime monitorStart;
datetime fireTime;
};
AlamoLevel g_levels[10];
void AlamoOnTick() {
bool con1 = AlamoCon1AllNegative(); // CACHE 1× per tick
double ddNow = AlamoCurrentDDPct();
datetime now = TimeCurrent();
AlamoProcessL1(con1, ddNow, now); // L1 special
for(int i=1; i<AlamoMaxLevels; i++) {
if(g_levels[i-1].state != ACTIVE) break; // short-circuit
AlamoProcessLevel(g_levels[i], con1, ddNow, now);
}
AlamoCheckCloseTriggers(); // combined close + redundancy
AlamoUIRender(); // panel update
}
| Type | Owner | Status |
|---|---|---|
| Per-level self-close (profit ≥ threshold) | Mini-module L_n | NEW |
| Combined close (sumProfit ≥ threshold) | PosMan override | KEEP |
| Redundancy CloseAll (9 sites) | Hotfix1 | KEEP |
Add input:
input bool AlamoOnly = true; // Test mode: only ALAMO runs, main grid placement gated
Guard với if(!AlamoOnly):
ArcherResetCycle/ArcherFire callsRangerCheck + RangerIsBlockedKEEP intact:
#include <FBot/FBotGridManager.mqh> + FBotRanger.mqh (infrastructure)AlamoInit/OnTick/Deinit/CloseAllFuture re-enable: set AlamoOnly=false → main grid + ALAMO chạy song song như Hotfix3
| Hotfix | Bug fixed | Hotfix4 status |
|---|---|---|
| Hotfix1 — PosManCloseAlamo (05-13 22:24) | Orphan Ln on close-all (5 sites missing AlamoCloseAll) | ✓ preserved (9 sites intact) |
| Hotfix2 — L2L3Fire (05-13 23:12) | Gate location + N×Thr scaling | ✓ preserved (fireGate = N×Thr) |
| Hotfix3 — LotSnowball (05-14 07:58) | Lot cascade fix + cooldown 10s | ✓ preserved (L1-fixed anchor) |
| Hotfix4 — Modular (05-14 13:47) | Strip main grid + per-Ln modular + offset 2.0→2.5 | 🚧 planning |
┌─ ALAMO TRACKER ────────────────────┐ │ Stage: ACTIVE | Next: L3 │ │ DD: 24.32% | EqAnchor: 277081 │ │ ────────────────────────────────── │ │ L1 ✓ ACTIVE 10% t=509 +$120 │ │ L2 ✓ ACTIVE 20% t=512 -$45 │ │ L3 ⏳ MONITOR 30% pre-arm 27.5% │ │ L4 ○ IDLE 40% │ │ L5 ○ IDLE 50% │ │ L6 ○ IDLE 60% │ │ (L7-L10 collapsed if IDLE) │ └────────────────────────────────────┘
| Source | Symbol | Period |
|---|---|---|
Tester/Agent-127.0.0.1-3000/logs/20260514-Feb18-Feb26.zip | XAUUSD.s M5 | 02.18 – 02.26 |
Tester/Agent-127.0.0.1-3000/logs/20260514-Mar18-Mar26.zip | XAUUSD.s M5 | 03.18 – 03.26 |
~/Downloads/20260514.log | XAUUSD.s M15 | 02.18 – 02.26 (Hotfix2 ref) |
| # | Phase | Priority | Status |
|---|---|---|---|
| 1 | Guard main grid with AlamoOnly flag (Scope A) | P0 | TODO |
| 2 | Refactor FBotAlamo.mqh → per-Ln array | P0 | TODO |
| 3 | State machine IDLE → MONITOR → ACTIVE | P0 | TODO |
| 4 | Per-level close + global redundancy | P0 | TODO |
| 5 | UI panel ALAMO tracker | P1 | TODO |
| 6 | Compile + tester verify | P0 | TODO |
AlamoOnly=true, không stripAll decisions locked — ready for implementation.