Chiến lược & backtestStrategy & backtests

Bộ phòng thủ whipsaw — v1.36 / v1.37 (+ Defense Group v1.39)Whipsaw Defense Suite — v1.36 / v1.37 (+ Defense Group v1.39)

Bảo vệ EA khỏi thị trường giằng co (whipsaw/chop): giữ lợi nhuận kiểu Pass 10 khi có trend, chặn vào lệnh khi thị trường đi ngang. Protect the EA from whipsaw/choppy markets: keep Pass 10-style profit while trending, block entries while the market chops.

  • Cập nhậtUpdated 18/09/2026
  • NguồnSource docs/WHIPSAW_DEFENSE.md · GoldenRobber-1.42.mq5 (Defense Group)(Defense Group)
  • Bản gốcOriginal v1.36 + v1.37 · 25/05/2026
Bối cảnh phiên bảnVersion context

Tài liệu gốc mô tả v1.36 (Choppy Filter + Anti-Whipsaw) và v1.37 (Adaptive NP + Multi-TF + Dual-Direction) với giá trị mặc định thời đó. Cả 5 tính năng vẫn còn trong EA production 1.42 b7, kèm công tắc nhóm Choppy Defense Group (v1.39) và tách ApplyInit/ApplyAdd cho Multi-TF (v1.41). Hai phần này không có trong tài liệu gốc; trang này bổ sung từ mã nguồn 1.42 và ghi rõ nhãn. Config ổn định v1.42.b7-pass58.set bật cả 5 tính năng và cả Defense Group (chỉ trigger theo số lệnh ≥ 24). Xem bảng đối chiếu · Config ổn định · tham số Whipsaw.

The original document covers v1.36 (Choppy Filter + Anti-Whipsaw) and v1.37 (Adaptive NP + Multi-TF + Dual-Direction) with the defaults of that time. All five features are still in the production EA 1.42 b7, plus the Choppy Defense Group master switch (v1.39) and the Multi-TF ApplyInit/ApplyAdd split (v1.41). Those two are not in the original document; this page adds them from the 1.42 source and labels them. The stable config v1.42.b7-pass58.set turns on all five features and the Defense Group (triggered only by order count ≥ 24). See the comparison table · Stable config · Whipsaw parameters.

1. Vấn đề1. Problem statement

Giai đoạn 5-11/02/2025 — thảm hoạ của Pass 10Period 5-11/02/2025 — the Pass 10 disaster

Config Pass 10 (nhạy: TF=M5, NeutralPips=5) gặp thị trường giằng co với nhiều cú swing → kết quả:

  • Lỗ nổi (floating loss): -$55,518
  • Equity DD Absolute: $64,377 → đáy equity $35,623 (vốn ban đầu $100k)
  • Kẹt hai chiều: 27 Buy + 12 Sell cùng kẹt
  • Chế độ cứu của Tia ở trạng thái ACT liên tục

The Pass 10 config (sensitive: TF=M5, NeutralPips=5) met a choppy market with multiple swings → result:

  • Floating loss: -$55,518
  • Equity DD Absolute: $64,377 → equity bottom $35,623 ($100k initial)
  • Bidirectional stuck: 27 Buys + 12 Sells trapped at once
  • Tia rescue mode ACT continuously

Nguyên nhân gốcRoot cause

  1. Trend Filter quá nhạy — lật UP/DOWN theo mọi biến động nhỏ.
  2. Mỗi lần lật → Init mới → mở round hai chiều.
  3. Không có lớp phòng thủ nào nhận biết regime "trending hay choppy".
  4. Tính cách Pass 10 (nhạy) = dễ tổn thương trước whipsaw.
  1. Trend Filter too sensitive — flips UP/DOWN on every micro move.
  2. Every flip → a new Init → bidirectional rounds open.
  3. No defense layer detects the "trending vs choppy" regime.
  4. Pass 10's (sensitive) character = vulnerable to whipsaw.

2. Giải pháp: 5 lớp phòng thủ thích ứng2. Solution: 5 adaptive defense layers

Triết lý "Phòng thủ nhiều lớp + giữ lợi nhuận" (Layered Defense + Profit Preservation):Philosophy: "Layered Defense + Profit Preservation":

Layer 1 — Thích ứng thông minh (3 tính năng, mặc định ON)Layer 1 — Adaptive intelligence (3 features, default ON)

  • Choppy Filter (ADX) — chủ động (proactive)
  • Anti-Whipsaw Cooldown — phản hồi sau sự kiện (reactive feedback)
  • Adaptive Trend NeutralPips — độ nhạy theo regime
  • Choppy Filter (ADX) — proactive
  • Anti-Whipsaw Cooldown — reactive feedback
  • Adaptive Trend NeutralPips — regime-aware sensitivity

Layer 2 — Búa tạ (2 tính năng, mặc định OFF)Layer 2 — Heavy hammer (2 features, default OFF)

  • Multi-TF Trend Confirmation — bắt buộc HTF đồng thuận nghiêm ngặt
  • Dual-Direction Prohibition khi chop — chặn mở hai chiều trong chop
  • Multi-TF Trend Confirmation — strict HTF agreement required
  • Dual-Direction Prohibition during chop — kill bidirectional entries during chop

Layer 1 đủ cho 80% kịch bản. Layer 2 dành cho cách vận hành cực kỳ thận trọng.Layer 1 covers 80% of scenarios. Layer 2 is for ultra-conservative operation.

3. Tính năng 1: Choppy Filter (dựa trên ADX)3. Feature 1: Choppy Filter (ADX-based)

Cơ chếMechanism

Truy vấn ADX(14) trên TF cấu hình được. Nếu ADX < ngưỡng → thị trường choppy/đi ngang → chặn Init.

ADX đo SỨC MẠNH trend (không quan tâm hướng):

  • ADX > 30: trend mạnh
  • ADX 20-30: trend yếu
  • ADX < 20: đi ngang/chop

Query ADX(14) on a configurable TF. If ADX < threshold → the market is choppy/ranging → block Init.

ADX measures trend STRENGTH (regardless of direction):

  • ADX > 30: strong trend
  • ADX 20-30: weak trend
  • ADX < 20: range/chop

Tham sốInputs

InputDefaultGhi chúNotes
InpChoppyFilterEnabletrue (v1.37)Công tắc chínhMaster switch
InpChoppyFilterTFPERIOD_M15Khuyến nghị H1 cho tín hiệu ổn địnhH1 recommended for stability
InpChoppyAdxPeriod14ChuẩnStandard
InpChoppyAdxMinForTrend22.0M15:25, H1:22, H4:20
InpChoppyApplyInittrueChặn InitBlock Init
InpChoppyApplyAddfalseMặc định OFF (giữ khả năng DCA recovery)Default OFF (preserves DCA recovery)

Đánh đổi theo TFTF trade-off

TFTốc độSpeedĐộ ổn địnhStabilityFalse+False-Phù hợp choBest for
M15NhanhFastNhiễuNoisyCaoHighThấpLowChop chớp nhoáng trong ngàyIntraday flash chop
H1VừaMediumỔn địnhStableVừaMedVừaMedPass 10 khuyến nghịrecommended
H4ChậmSlowRất ổn địnhVery stableThấpLowCaoHighSwing

4. Tính năng 2: Anti-Whipsaw Cooldown4. Feature 2: Anti-Whipsaw Cooldown

Cơ chếMechanism

Phản hồi sau sự kiện. Truy vấn history lấy P/L đã chốt trong N giờ gần nhất. Nếu lỗ đã chốt ≥ ngưỡng → bắt đầu cooldown M giờ, chặn Init mới.Reactive feedback. Query history for realized P/L over the last N hours. If realized loss ≥ threshold → start an M-hour cooldown that blocks new Init.

Tham sốInputs

InputDefaultKhuyến nghị H1-stableRecommended H1-stable
InpAntiWhipsawEnabletruetrue
InpAntiWhipsawLookbackH812 (dài hơn = ổn định hơn)(longer = stable)
InpAntiWhipsawMaxLossUSD200250 (bớt nhạy cò)(less hair-trigger)
InpAntiWhipsawCooldownH46 (khớp chu kỳ H1)(match H1 cycle)

Lưu trạng tháiState persistence

  • g_antiWhipsawCooldownUntil (datetime) — mốc hết hạn cooldown
  • Còn hiệu lực cho tới khi TimeCurrent() >= g_antiWhipsawCooldownUntil
  • Chỉ đánh giá lại khi không đang trong cooldown
  • g_antiWhipsawCooldownUntil (datetime) — cooldown expiry timestamp
  • Active until TimeCurrent() >= g_antiWhipsawCooldownUntil
  • Re-evaluation happens only when not in an active cooldown

Công thức kích hoạtTrigger formula

if (realized loss in last LookbackH hours >= MaxLossUSD) {
   cooldownUntil = now + CooldownH * 3600;
}

5. Tính năng 3: Adaptive Trend NeutralPips (v1.37+)5. Feature 3: Adaptive Trend NeutralPips (v1.37+)

Cơ chếMechanism

Cải tiến chính của v1.37. NeutralPips của TrendFilter tự động co giãn theo regime ADX hiện tại:Key innovation of v1.37. The TrendFilter NeutralPips scales automatically with the current ADX regime:

Vùng ADXADX rangeNeutralPipsHành viBehavior
ADX ≥ ngưỡng Strong (30)ADX ≥ Strong threshold (30)NeutralStrong (5)Nhạy, bắt được sóng (giống nền Pass 10)Sensitive, captures moves (Pass 10 baseline)
ADX giữa Weak và Strong (20-30)ADX between Weak and Strong (20-30)NeutralMid (15)Lọc vừa phảiModerate filter
ADX < ngưỡng Weak (20)ADX < Weak threshold (20)NeutralWeak (50)Chặt, chặn nhiễuStrict, blocks noise

Tham sốInputs

InputDefaultGhi chúNotes
InpTrendAdaptivetrue (v1.37)Công tắc chínhMaster switch
InpTrendAdaptiveADXStrong30.0ADX ≥ → regime StrongADX ≥ → Strong regime
InpTrendAdaptiveADXWeak20.0ADX < → regime ChopADX < → Chop regime
InpTrendNeutralStrong5NP khi trend mạnhNP when strong trend
InpTrendNeutralMid15NP khi chưa rõ ràngNP when ambiguous
InpTrendNeutralWeak50NP khi chopNP when chop
Quan trọng: ghi đè input tĩnhImportant: overrides the static input

Khi InpTrendAdaptive=true, giá trị InpTrendFilterNeutralPips bị BỎ QUA. EA dùng các ngưỡng thích ứng. Để quay về hành vi cũ (dùng giá trị tĩnh), đặt InpTrendAdaptive=false.

When InpTrendAdaptive=true, the InpTrendFilterNeutralPips value is IGNORED. The EA uses the adaptive thresholds. To revert to legacy behavior (static value), set InpTrendAdaptive=false.

Bổ sung từ mã nguồn 1.42: giá trị tĩnh InpTrendFilterNeutralPips vẫn được dùng khi ADX không đọc được, hoặc khi Defense Group đang BYPASS (xem mục 8).

Added from the 1.42 source: the static InpTrendFilterNeutralPips is still used when ADX cannot be read, or while the Defense Group is in BYPASS (see section 8).

Giữ lợi nhuậnProfit preservation

  • ADX ≥ 30: NP=5, giống hệt Pass 10 → giữ nguyên khả năng bắt trend
  • ADX 20-30: NP=15, chặt hơn một chút → giảm tín hiệu sai
  • ADX < 20: NP=50, chặn hoàn toàn chop
  • ADX ≥ 30: NP=5, identical to Pass 10 → trend capture intact
  • ADX 20-30: NP=15, slightly stricter → fewer false signals
  • ADX < 20: NP=50, blocks chop entirely

6. Tính năng 4: Multi-TF Trend Confirmation (mặc định OFF)6. Feature 4: Multi-TF Trend Confirmation (default OFF)

Cơ chếMechanism

Yêu cầu hướng trend của HTF (vd. H1) trùng với hướng của TF chính trước khi cho Init.Require the HTF (e.g. H1) trend direction to match the primary TF direction before Init fires.

Primary M5 = UP   AND HTF H1 = UP           → allow Buy
Primary M5 = UP   AND HTF H1 = DOWN/neutral → block Buy
Primary M5 = DOWN AND HTF H1 = DOWN         → allow Sell
Primary M5 = DOWN AND HTF H1 = UP/neutral   → block Sell

Vì sao mặc định OFFWhy default OFF

  • Phòng thủ chặt → có thể giảm lợi nhuận 10-25%
  • Với lối đánh intraday mạnh tay (Pass 10), thường chặn nhầm các trend nhanh hợp lệ chưa kịp lan lên HTF
  • Phù hợp nhất cho chiến lược swing hoặc deploy cực kỳ thận trọng
  • Strict defense → may reduce profit by 10-25%
  • For aggressive intraday trading (Pass 10) it often blocks legitimate fast trends that have not yet reached the HTF
  • Best for swing strategies or ultra-conservative deployments

Tham sốInputs

InputDefaultGhi chúNotes
InpMultiTfTrendEnablefalseCông tắc chínhMaster switch
InpMultiTfTrendHigherTFPERIOD_H1HTF dùng để xác nhậnHTF used for confirmation
InpMultiTfTrendHigherMAPeriod50Chu kỳ MA trên HTFMA period on the HTF
InpMultiTfTrendApplyInittrueBổ sung v1.41 (không có trong tài liệu gốc): áp xác nhận HTF cho InitAdded in v1.41 (not in the original doc): apply HTF confirmation to Init
InpMultiTfTrendApplyAddfalseBổ sung v1.41: áp xác nhận HTF cho Add (bồi), để HTF phủ quyết lệnh bồi ngược trendAdded in v1.41: apply HTF confirmation to Adds, letting the HTF veto counter-trend adds

Khi nào nên bậtWhen to enable

Nên bậtEnable for

  • Giao dịch swing
  • Vốn ≥ $300k (chịu được số lệnh ít hơn)
  • Backtest cho thấy Layer 1 chưa đủ
  • Swing trading
  • Capital ≥ $300k (can afford a lower trade count)
  • Backtest shows Layer 1 is insufficient

Không nên bậtAvoid for

  • Tính cách Pass 10 (scalping intraday)
  • Pass 10 character (intraday scalping)

7. Tính năng 5: Dual-Direction Prohibition khi chop (mặc định OFF)7. Feature 5: Dual-Direction Prohibition during chop (default OFF)

Cơ chếMechanism

Khi phát hiện chop VÀ đã có lệnh ở phía X → chặn Init phía đối diện. Ngăn kịch bản kẹt hai chiều (như 5-11/02/2025).When chop is detected AND positions already exist on side X → block Init on the opposite side. Prevents the bidirectional-stuck scenario (like 5-11/02/2025).

Vì sao mặc định OFFWhy default OFF

  • Chiến lược DCA Hedging về bản chất dùng lệnh hai chiều
  • Tia đóng cụm hiệu quả nhất khi có cả Buy lẫn Sell
  • Dual-Direction triệt tiêu cơ hội hedge
  • Trường hợp dùng khá hẹp
  • The DCA Hedging strategy fundamentally relies on bidirectional positions
  • Tia cluster close works best with mixed Buy + Sell
  • Dual-Direction kills hedge opportunities
  • Niche use case

Tham sốInputs

InputDefaultGhi chúNotes
InpDualDirChopEnablefalseCông tắc chínhMaster switch

Khi nào nên bậtWhen to enable

Nên bậtEnable when

  • Backtest cho thấy kẹt hai chiều lặp lại
  • Tia đóng cụm không hiệu quả
  • Backtest shows recurring bidirectional stuck
  • Tia cluster close is not closing effectively

Không nên bậtAvoid when

  • DCA hedging là chiến lược cốt lõi
  • Layer 1 đã đủ
  • DCA hedging is the core strategy
  • Layer 1 is already sufficient
Ghi chú từ mã nguồn 1.42Note from the 1.42 source

Trong luồng Init, Dual-Direction chỉ chạy khi Choppy Filter đang báo chop (và Defense Group đang ACTIVE), và chỉ khi mới có lệnh ở đúng một phía. Theo chú thích trong code: nếu Choppy Filter đã chặn cả hai phía (InpChoppyApplyInit=true) thì Dual-Direction không thêm tác dụng nào cho Init; nó hữu ích khi tắt InpChoppyApplyInit mà vẫn muốn chặn hai chiều trong chop. Config ổn định đang để cả InpChoppyApplyInit=true lẫn InpDualDirChopEnable=true.

In the Init path, Dual-Direction runs only while the Choppy Filter reports chop (and the Defense Group is ACTIVE), and only when positions exist on exactly one side. Per the code comment: if the Choppy Filter already blocks both sides (InpChoppyApplyInit=true), Dual-Direction adds no extra effect for Init; it matters when InpChoppyApplyInit is off but you still want bidirectional defense in chop. The stable config sets both InpChoppyApplyInit=true and InpDualDirChopEnable=true.

8. Choppy Defense Group — kích hoạt theo trigger (v1.39+)8. Choppy Defense Group — trigger-based activation (v1.39+)

bổ sung Mục này không có trong docs/WHIPSAW_DEFENSE.md; nội dung lấy từ chú thích input và hàm IsChoppyDefenseActive() trong GoldenRobber-1.42.mq5 (input giống hệt trong GoldenRobber-1.41.4.mq5).added This section is not in docs/WHIPSAW_DEFENSE.md; it comes from the input comments and the IsChoppyDefenseActive() function in GoldenRobber-1.42.mq5 (the inputs are identical in GoldenRobber-1.41.4.mq5).

Một công tắc tổng gác cả 5 bộ lọc choppy bằng các điều kiện trigger:

  • InpChoppyDefenseGroupEnable=false (mặc định): mỗi bộ lọc (Choppy / AntiWhip / AdaptiveNP / MultiTF / DualDir) chạy độc lập theo enable riêng — hành vi cũ v1.36-1.38.
  • InpChoppyDefenseGroupEnable=true: 5 bộ lọc CHỈ áp dụng khi ÍT NHẤT 1 trigger đạt.

Ý tưởng: tài khoản khoẻ (ít lệnh, không lỗ, cân lot) → bỏ qua phòng thủ → giao dịch mạnh tay. Tài khoản căng (nhiều lệnh / lỗ / lệch lot) → phòng thủ BẬT → chế độ thận trọng.

One master switch gates all five choppy filters behind trigger conditions:

  • InpChoppyDefenseGroupEnable=false (default): each filter (Choppy / AntiWhip / AdaptiveNP / MultiTF / DualDir) works independently per its own enable — legacy v1.36-1.38 behavior.
  • InpChoppyDefenseGroupEnable=true: the five filters apply ONLY when AT LEAST ONE trigger fires.

Idea: a healthy account (few orders, no loss, balanced lots) → bypass the defenses → trade aggressively. A stressed account (many positions / loss / imbalance) → defenses ACTIVATE → conservative mode.

Các triggerTriggers

InputMặc định (1.41.4 / 1.42)Default (1.41.4 / 1.42)Config ổn địnhStable configTrigger đạt khiFires when
InpChoppyDefenseGroupEnablefalsetrueCông tắc tổngMaster switch
InpChoppyDefenseMinOrders1024Tổng số lệnh ≥ N (đếm lệnh cùng symbol + magic, bỏ lệnh có comment chứa Hedge)Total positions ≥ N (counts this symbol + magic, skipping positions whose comment contains Hedge)
InpChoppyDefenseNegProfitUSD300.00.0 (tắt)(off)Lỗ nổi ≥ X USDFloating loss ≥ X USD
InpChoppyDefenseLotDiffMin0.50.0 (tắt)(off)|BuyLot − SellLot| ≥ X (volume không tính hedge)|BuyLot − SellLot| ≥ X (volume excluding hedges)

Trigger nào đặt 0 = tắt (không tính trigger đó). Với config ổn định, phòng thủ chỉ BẬT khi có từ 24 lệnh (không tính hedge) trở lên; dưới 24 lệnh cả 5 bộ lọc bị bỏ qua.Any trigger set to 0 is disabled (not counted). With the stable config, the defenses turn ON only at 24 or more non-hedge positions; below 24, all five filters are bypassed.

BYPASS nghĩa là gì với từng bộ lọcWhat BYPASS means for each filter

Bộ lọcFilterHàmFunctionKhi group BYPASSWhile the group is in BYPASS
Choppy FilterIsChoppyMarket()Trả false → không chặnReturns false → no block
Adaptive NPEffectiveTrendNeutralPips()Dùng giá trị tĩnh InpTrendFilterNeutralPipsUses the static InpTrendFilterNeutralPips
Multi-TFIsHigherTfTrendAgreeing()Trả true → không kiểm tra HTFReturns true → no HTF check
Anti-WhipsawIsAntiWhipsawCooldown()Trả false → không chặn, kể cả khi mốc cooldown chưa hếtReturns false → no block, even if the cooldown timestamp has not expired
Dual-Directionluồng InitInit pathKhông áp dụngNot applied
flowchart TD
  G{"Defense Group bật?"}
  G -- "không" --> L["5 bộ lọc chạy độc lập theo enable riêng"]
  G -- "có" --> T{"Ít nhất 1 trigger đạt?"}
  T1["Số lệnh ≥ MinOrders"] -.-> T
  T2["Lỗ nổi ≥ NegProfitUSD"] -.-> T
  T3["Lệch lot Buy/Sell ≥ LotDiffMin"] -.-> T
  T -- "có" --> A["ACTIVE: áp dụng các bộ lọc"]
  T -- "không" --> B["BYPASS: bỏ qua cả 5 bộ lọc, NeutralPips tĩnh"]
  L --> F["Choppy · AntiWhip · AdaptiveNP · MultiTF · DualDir"]
  A --> F

Cổng Defense Group quyết định 5 bộ lọc có được áp dụng hay không. Trạng thái được cache mỗi tick (theo TimeCurrent()).

flowchart TD
  G{"Defense Group enabled?"}
  G -- "no" --> L["5 filters run independently per own enable"]
  G -- "yes" --> T{"At least 1 trigger fired?"}
  T1["Positions ≥ MinOrders"] -.-> T
  T2["Floating loss ≥ NegProfitUSD"] -.-> T
  T3["Buy/Sell lot gap ≥ LotDiffMin"] -.-> T
  T -- "yes" --> A["ACTIVE: filters apply"]
  T -- "no" --> B["BYPASS: all 5 filters skipped, static NeutralPips"]
  L --> F["Choppy · AntiWhip · AdaptiveNP · MultiTF · DualDir"]
  A --> F

The Defense Group gate decides whether the five filters apply. The state is cached once per tick (by TimeCurrent()).

Log và bannerLogs and banner

EA ghi log mỗi khi trạng thái chuyển BYPASS ↔ ACTIVE (dạng in trong Journal, bỏ biểu tượng đầu dòng):The EA logs every BYPASS ↔ ACTIVE transition (as printed in the Journal, leading icon omitted):

Choppy Defense ACTIVATED — triggers: orders=N(>=MinOrders) loss=$X(>=$NegProfitUSD) lotDiff=Y(>=LotDiffMin)
Choppy Defense BYPASSED — account healthy (orders=N loss=$X lotDiff=Y)

GoldenRobber v1.42 (<build>) loaded — DefenseGrp=ON(ord>=24|loss>=0|lotDiff>=0.00) Choppy=ON AntiWhip=ON AdaptiveNP=ON MultiTF=ON DualDirChop=ON

Dòng ACTIVATED chỉ liệt kê những trigger thực sự đạt. Banner ở trên minh hoạ giá trị của config ổn định.The ACTIVATED line lists only the triggers that actually fired. The banner above illustrates the stable config's values.

Thứ tự lọc trong luồng Init (1.42)Filter order in the Init path (1.42)

bổ sung Từ mã nguồn 1.42, các bộ lọc hướng cho Init chạy lần lượt; mỗi bước chỉ có thể tắt thêm allowBuy/allowSell:added From the 1.42 source, the Init direction filters run in sequence; each step can only switch allowBuy/allowSell off:

  1. Multi-TF (khi InpMultiTfTrendEnable và InpMultiTfTrendApplyInit) — chặn phía nào HTF không đồng thuận.
  2. Pivot và Wick (các bộ lọc khác, không thuộc bộ whipsaw).
  3. Choppy Filter (khi InpChoppyApplyInit) — chặn cả hai phía.
  4. Dual-Direction — chặn phía đối diện khi chop và mới có lệnh một phía.
  5. Anti-Whipsaw — trong cooldown thì chặn cả hai phía.
  6. StrongMove bypass (v1.41.2) và Manual Init — bỏ qua mọi bộ lọc hướng ở trên và ép một chiều.
  1. Multi-TF (when InpMultiTfTrendEnable and InpMultiTfTrendApplyInit) — blocks any side the HTF does not confirm.
  2. Pivot and Wick (other filters, not part of the whipsaw suite).
  3. Choppy Filter (when InpChoppyApplyInit) — blocks both sides.
  4. Dual-Direction — blocks the opposite side while choppy with positions on one side only.
  5. Anti-Whipsaw — during a cooldown, blocks both sides.
  6. StrongMove bypass (v1.41.2) and Manual Init — override every direction filter above and force one direction.

9. Hiển thị trên Info Panel (v1.37)9. Info Panel display (v1.37)

Dòng trạng thái "Whip:"The "Whip:" status row

Whip: ADX=28.5(strong) NP=5 HTF↑✓
      │     │     │      │   │  └─ Đồng thuận: ✓ đồng ý, ✗ không đồng ý
      │     │     │      │   └──── Hướng HTF: ↑/↓/=
      │     │     │      └──────── NeutralPips đang dùng (Adaptive)
      │     │     └─────────────── Regime ADX
      │     └───────────────────── Giá trị ADX hiện tại
      └─────────────────────────── Nhãn dòng trạng thái tổng hợp
Whip: ADX=28.5(strong) NP=5 HTF↑✓
      │     │     │      │   │  └─ Agreement: ✓ agree, ✗ disagree
      │     │     │      │   └──── HTF direction: ↑/↓/=
      │     │     │      └──────── Effective NeutralPips (Adaptive)
      │     │     └─────────────── ADX regime
      │     └───────────────────── Current ADX value
      └─────────────────────────── Combined status

Dòng này chỉ hiện khi ít nhất một trong 5 tính năng đang bật.The row appears only when at least one of the five features is enabled.

Chỉ báo chặnBlock indicators

Khi có chặn, xuất hiện hậu tố: [BLK: CHOP+AW 142m+DD+HTF-MISS]When active, a suffix appears: [BLK: CHOP+AW 142m+DD+HTF-MISS]

TagÝ nghĩaMeaning
CHOPChoppy Filter đang chặnChoppy Filter blocking
AW XmAnti-Whipsaw cooldown, còn X phútAnti-Whipsaw cooldown, X minutes remaining
DDDual-Direction Prohibition đang chặnDual-Direction Prohibition blocking
HTF-MISSMulti-TF không đồng thuận (chặn theo hướng)Multi-TF disagreement (directional block)

Trong code 1.42, các tag được nối bằng dấu cách và tag cooldown in liền, ví dụ [BLK: CHOP AW142m DD HTF-MISS ].In the 1.42 code the tags are space-separated and the cooldown tag has no inner space, e.g. [BLK: CHOP AW142m DD HTF-MISS ].

Tiền tố Defense Group (v1.39)Defense Group prefix (v1.39)

bổ sung Khi InpChoppyDefenseGroupEnable=true, ngay sau Whip: có thêm [ACTIVE ord=N loss=$X lotDiff=Y ] (chỉ liệt kê trigger đã đạt) hoặc [BYPASS]. Khi BYPASS, CHOP/AW/DD không bao giờ hiện (HTF-MISS vẫn có thể hiện). Ví dụ minh hoạ:added With InpChoppyDefenseGroupEnable=true, right after Whip: the row shows [ACTIVE ord=N loss=$X lotDiff=Y ] (only fired triggers listed) or [BYPASS]. In BYPASS, CHOP/AW/DD never appear (HTF-MISS still can). Illustrative examples:

Whip: [BYPASS] ADX=24.1(mid) NP=10 HTF↑✓
Whip: [ACTIVE ord=26 ] ADX=17.3(chop) NP=50 HTF=✗ [BLK: CHOP HTF-MISS ]

Mã màuColor coding

MàuColorĐiều kiệnCondition
LimeKhông có chặn, HTF đồng thuậnNo blocks, HTF agreement
OrangeChỉ HTF-MISS (cảnh báo theo hướng)HTF-MISS only (directional warning)
OrangeRedĐang có chặn toàn cục (CHOP/AW/DD)Global block active (CHOP/AW/DD)

Xem thêm Info panel.See also Info panel.

H1-Stable (khuyến nghị cho production lúc đó)H1-Stable (recommended for production at the time)

; Choppy Filter — H1 ổn định
InpChoppyFilterEnable     = true
InpChoppyFilterTF         = PERIOD_H1
InpChoppyAdxMinForTrend   = 22.0
InpChoppyApplyInit        = true
InpChoppyApplyAdd         = false

; Anti-Whipsaw — cửa sổ/cooldown dài hơn cho ổn định
InpAntiWhipsawEnable      = true
InpAntiWhipsawLookbackH   = 12
InpAntiWhipsawMaxLossUSD  = 250
InpAntiWhipsawCooldownH   = 6

; Adaptive NeutralPips — hiệu chỉnh cho H1
InpTrendAdaptive          = true
InpTrendAdaptiveADXStrong = 28.0
InpTrendAdaptiveADXWeak   = 18.0
InpTrendNeutralStrong     = 5
InpTrendNeutralMid        = 20
InpTrendNeutralWeak       = 50

; Multi-TF — BẬT để ổn định tối đa
InpMultiTfTrendEnable     = true
InpMultiTfTrendHigherTF   = PERIOD_H1

; Dual-Direction — BẬT
InpDualDirChopEnable      = true

Kỳ vọng so với Pass 10 gốc:

  • Profit: -20-29%
  • Sharpe: +33-59%
  • Balance DD: -40-60%
  • Equity DD Abs: -50-70%
; Choppy Filter — H1 stable
InpChoppyFilterEnable     = true
InpChoppyFilterTF         = PERIOD_H1
InpChoppyAdxMinForTrend   = 22.0
InpChoppyApplyInit        = true
InpChoppyApplyAdd         = false

; Anti-Whipsaw — longer window/cooldown for stability
InpAntiWhipsawEnable      = true
InpAntiWhipsawLookbackH   = 12
InpAntiWhipsawMaxLossUSD  = 250
InpAntiWhipsawCooldownH   = 6

; Adaptive NeutralPips — H1-calibrated
InpTrendAdaptive          = true
InpTrendAdaptiveADXStrong = 28.0
InpTrendAdaptiveADXWeak   = 18.0
InpTrendNeutralStrong     = 5
InpTrendNeutralMid        = 20
InpTrendNeutralWeak       = 50

; Multi-TF — ENABLED for max stability
InpMultiTfTrendEnable     = true
InpMultiTfTrendHigherTF   = PERIOD_H1

; Dual-Direction — ENABLED
InpDualDirChopEnable      = true

Expected vs raw Pass 10:

  • Profit: -20-29%
  • Sharpe: +33-59%
  • Balance DD: -40-60%
  • Equity DD Abs: -50-70%

Mặc định v1.37 (cân bằng)Default v1.37 (balanced)

; 3 tính năng mặc định ON (chỉ Layer 1)
InpChoppyFilterEnable     = true  (default)
InpAntiWhipsawEnable      = true  (default)
InpTrendAdaptive          = true  (default)

; 2 tính năng mặc định OFF (Layer 2 tự bật khi cần)
InpMultiTfTrendEnable     = false (default)
InpDualDirChopEnable      = false (default)

Kỳ vọng so với Pass 10 gốc:

  • Profit: -10-15%
  • Sharpe: +16-32%
  • Balance DD: -30-40%
; 3 features ON by default (Layer 1 only)
InpChoppyFilterEnable     = true  (default)
InpAntiWhipsawEnable      = true  (default)
InpTrendAdaptive          = true  (default)

; 2 features OFF by default (Layer 2 opt-in)
InpMultiTfTrendEnable     = false (default)
InpDualDirChopEnable      = false (default)

Expected vs raw Pass 10:

  • Profit: -10-15%
  • Sharpe: +16-32%
  • Balance DD: -30-40%

Legacy (hành vi Pass 10 gốc)Legacy (raw Pass 10 behavior)

; Tắt cả 5 tính năng
InpChoppyFilterEnable     = false
InpAntiWhipsawEnable      = false
InpTrendAdaptive          = false
InpMultiTfTrendEnable     = false
InpDualDirChopEnable      = false

Hành vi giống hệt v1.35 trở về trước.

; Disable all 5 features
InpChoppyFilterEnable     = false
InpAntiWhipsawEnable      = false
InpTrendAdaptive          = false
InpMultiTfTrendEnable     = false
InpDualDirChopEnable      = false

Behavior identical to v1.35 and earlier.

11. Chuyển đổi & tương thích11. Migration & compatibility

Nạp file .set cũ vào v1.37Loading old .set files into v1.37

File .set cũ (Pass 10, ScalpingTrending, A baseline) không có 5 dòng input của v1.36/37. Khi nạp vào EA v1.37, chúng dùng mặc định MỚI:

  • Choppy Filter ON (trước là OFF)
  • Anti-Whipsaw ON (trước là OFF)
  • Adaptive NP ON (trước là OFF/chưa tồn tại)

→ Hành vi thay đổi. Chiến lược giờ có phòng thủ whipsaw theo mặc định.

Bổ sung (v1.39+): .set không có InpChoppyDefenseGroupEnable sẽ nhận mặc định false → các bộ lọc chạy độc lập như trên.

Old .set files (Pass 10, ScalpingTrending, A baseline) do not contain the 5 v1.36/37 input lines. When loaded into EA v1.37 they use the NEW defaults:

  • Choppy Filter ON (was OFF)
  • Anti-Whipsaw ON (was OFF)
  • Adaptive NP ON (was OFF/non-existent)

→ Behavior changes. The strategy now has whipsaw defense by default.

Addition (v1.39+): a .set without InpChoppyDefenseGroupEnable gets the default false → the filters run independently as above.

Muốn đúng hành vi trước v1.36To get exact pre-v1.36 behavior

Đặt tường minh 3 input về false:Set three inputs explicitly to false:

InpChoppyFilterEnable = false
InpAntiWhipsawEnable  = false
InpTrendAdaptive      = false

Muốn phòng thủ tối đa (H1-stable)To enable max defense (H1-stable)

Xem config H1-Stable ở trên.See the H1-Stable config above.

12. Kế hoạch kiểm chứng bằng backtest12. Backtest verification plan

  1. Compile lại EA v1.37. Banner phải hiển thị:
    GoldenRobber v1.37 loaded — Choppy=ON AntiWhip=ON AdaptiveNP=ON MultiTF=OFF DualDirChop=OFF ChainPersist=OFF StuckLock=ON
  2. Backtest Pass 10 gốc trên giai đoạn chop 05/02/2025 → 11/02/2025. So sánh: lỗ nổi, chuỗi thua liên tiếp dài nhất, Equity DD. Kỳ vọng: Pass 10 + mặc định v1.37 → lỗ nổi giảm 50-70%.
  3. Backtest toàn giai đoạn 05/10/2025 → 23/05/2026 (giai đoạn optimize gốc của Pass 10). So sánh: Net Profit (kỳ vọng -10-15%), Sharpe (kỳ vọng +16-32%), DD% (kỳ vọng -30-40%).
  4. Chọn config deploy: nếu mặc định đủ → deploy với mặc định v1.37; nếu chop vẫn là vấn đề → bật Multi-TF + Dual-Direction (H1-stable); nếu lợi nhuận giảm không chấp nhận được → chỉ bật Multi-TF, giữ DualDir OFF.
  1. Recompile EA v1.37. The banner should display:
    GoldenRobber v1.37 loaded — Choppy=ON AntiWhip=ON AdaptiveNP=ON MultiTF=OFF DualDirChop=OFF ChainPersist=OFF StuckLock=ON
  2. Backtest the Pass 10 base on the choppy period 05/02/2025 → 11/02/2025. Compare: floating loss, max consecutive loss, Equity DD. Expected: Pass 10 + v1.37 defaults → floating loss reduced 50-70%.
  3. Backtest the full period 05/10/2025 → 23/05/2026 (Pass 10's original optimization period). Compare: Net Profit (expect -10-15%), Sharpe (expect +16-32%), DD% (expect -30-40%).
  4. Decide the deployment config: if the defaults suffice → deploy with v1.37 defaults; if chop is still a problem → enable Multi-TF + Dual-Direction (H1-stable); if the profit drop is unacceptable → enable Multi-TF only, keep DualDir OFF.

13. Tham chiếu mã nguồn13. Source code references

Thành phầnComponentVị tríLocation
Hàm Choppy FilterChoppy Filter helperGoldenRobber.mq5 · IsChoppyMarket()
Hàm Anti-WhipsawAnti-Whipsaw helperGoldenRobber.mq5 · IsAntiWhipsawCooldown()
Hàm Adaptive NPAdaptive NP helperGoldenRobber.mq5 · EffectiveTrendNeutralPips()
Hàm Multi-TFMulti-TF helperGoldenRobber.mq5 · GetHigherTfTrendDirection()
Gắn bộ lọc vào InitInit filter integrationLuồng Init trongInit path in OpenInitRoundPosNegPair()
Hiển thị info panelInfo panel displayUpdateInfoPanel() — dòng "Whip:""Whip:" row
Cổng Defense Group (bổ sung, v1.39+)Defense Group gate (added, v1.39+)GoldenRobber-1.42.mq5 · IsChoppyDefenseActive()

14. Hạn chế đã biết14. Known limitations

  1. Thời gian khởi động ADX: ADX(14) cần ~14 bar để hình thành. N bar đầu sau khi nạp EA, IsChoppyMarket trả false (không chặn).
  2. Chi phí HistorySelect: Anti-Whipsaw truy vấn history ở mỗi lần kiểm tra Init. Trong backtest có Init dày, chậm nhẹ (5-10%).
  3. ADX mâu thuẫn với Multi-TF: ADX mạnh không đảm bảo các TF đồng thuận. Có thể xảy ra: ADX=51 trend rất mạnh nhưng M5 và H1 bất đồng (thời điểm xoay chiều).
  4. Choppy Filter & DCA recovery: mặc định InpChoppyApplyAdd=false cho phép chuỗi DCA tiếp tục trong chop. Có thể kẹt sâu hơn nếu chop kéo dài.
  5. Độ trễ Multi-TF: HTF (H1) cần 1+ giờ để hình thành bar. Chiến lược có thể bỏ lỡ trend nhanh hợp lệ chưa lên HTF.
  1. ADX warm-up period: ADX(14) needs ~14 bars to form. For the first N bars after the EA loads, IsChoppyMarket returns false (no block).
  2. HistorySelect cost: Anti-Whipsaw queries history on every Init check. In backtests with frequent Init this means a slight slowdown (5-10%).
  3. ADX vs Multi-TF disagreement: a strong ADX does not guarantee TF agreement. Possible: ADX=51 strongly trending while M5 and H1 disagree (rotation moment).
  4. Choppy Filter & DCA recovery: the default InpChoppyApplyAdd=false lets the DCA chain continue in chop. That may lead to deeper stuck positions if the chop persists.
  5. Multi-TF lag: the HTF (H1) needs 1+ hours to form a bar. The strategy may miss legitimate fast trends not yet visible on the HTF.

15. Hướng cải tiến (đề xuất lúc 05/2026, cho v1.38+)15. Future improvements (proposed 05/2026, for v1.38+)

Các cải tiến có thể làm dựa trên phản hồi người dùng:Possible enhancements based on user feedback:

  1. Phát hiện chop bằng ADX nhiều TF — yêu cầu ADX thấp trên cả M15 VÀ H1 để có tín hiệu chop mạnh hơn.
  2. Ngưỡng ADX thích ứng theo regime biến động — tự chỉnh 22/25 theo ATR gần đây.
  3. Round Survival Tracker — theo dõi kết quả các round gần nhất, cooldown nếu K trên N round thua.
  4. Bộ lọc theo giờ — chỉ vào lệnh trong phiên sôi động (London/NY), tránh chop phiên Á.
  5. Vào lệnh khi biến động bung ra — chỉ Init sau pha tích luỹ + breakout được xác nhận.
  1. Multi-TF combined ADX detection — require low ADX on both M15 AND H1 for a stronger chop signal.
  2. Adaptive ADX threshold based on volatility regime — auto-adjust 22/25 from recent ATR.
  3. Round Survival Tracker — track recent rounds' outcomes; cool down if K of N are losing.
  4. Time-of-day filter — restrict entries to active sessions (London/NY), avoiding Asia chop.
  5. Volatility-expansion entry — only Init after consolidation + confirmed breakout.

16. Đối chiếu với config ổn định hiện tại16. Comparison with the current stable config

bổ sung Giá trị đọc từ README/configs/v1.42.b7-pass58.set. Cột mặc định lấy theo tài liệu v1.37 (riêng Defense Group và ApplyInit/ApplyAdd theo mã nguồn 1.42). Trend TF chính của config: InpTrendFilterTF=3 (PERIOD_M3).added Values read from README/configs/v1.42.b7-pass58.set. The default column follows the v1.37 document (Defense Group and ApplyInit/ApplyAdd follow the 1.42 source). The config's primary trend TF: InpTrendFilterTF=3 (PERIOD_M3).

InputMặc địnhDefaultConfig ổn địnhStable config
InpChoppyDefenseGroupEnablefalsetrue
InpChoppyDefenseMinOrders1024
InpChoppyDefenseNegProfitUSD300.00.0
InpChoppyDefenseLotDiffMin0.50.0
InpChoppyFilterEnabletruetrue
InpChoppyFilterTFPERIOD_M1516387 (PERIOD_H3)
InpChoppyAdxPeriod1414
InpChoppyAdxMinForTrend22.022.0
InpChoppyApplyInittruetrue
InpChoppyApplyAddfalsetrue
InpAntiWhipsawEnabletruetrue
InpAntiWhipsawLookbackH824
InpAntiWhipsawMaxLossUSD200250.0
InpAntiWhipsawCooldownH44
InpTrendAdaptivetruetrue
InpTrendAdaptiveADXStrong30.028.0
InpTrendAdaptiveADXWeak20.018.0
InpTrendNeutralStrong55
InpTrendNeutralMid1520
InpTrendNeutralWeak5050
InpTrendFilterNeutralPips (dùng khi BYPASS)(used in BYPASS)—10
InpMultiTfTrendEnablefalsetrue
InpMultiTfTrendHigherTFPERIOD_H116388 (PERIOD_H4)
InpMultiTfTrendHigherMAPeriod5050
InpMultiTfTrendApplyInittruetrue
InpMultiTfTrendApplyAddfalsefalse
InpDualDirChopEnablefalsetrue

Cách đọc: dưới 24 lệnh, config chạy M3 với NeutralPips tĩnh 10 và không bộ lọc whipsaw nào can thiệp; từ 24 lệnh trở lên, cả 5 bộ lọc bật với ADX trên H3 và xác nhận HTF trên H4. Chi tiết từng giá trị: Config ổn định.How to read it: below 24 positions the config runs M3 with a static NeutralPips of 10 and no whipsaw filter interferes; at 24 or more, all five filters engage, with ADX on H3 and HTF confirmation on H4. Every value in detail: Stable config.