From 7971e18cd9d9a1eccb1e8d3b0fa793c8c372633f Mon Sep 17 00:00:00 2001 From: Garfield Date: Sun, 22 Mar 2026 10:22:38 -0400 Subject: [PATCH] Update: v1.12 volatility filters implementation --- 2026-03-21-mql-trading-bots.md | 52 ++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/2026-03-21-mql-trading-bots.md b/2026-03-21-mql-trading-bots.md index 502fb3e..c40c2d3 100644 --- a/2026-03-21-mql-trading-bots.md +++ b/2026-03-21-mql-trading-bots.md @@ -273,3 +273,55 @@ file:///home/garfield/mt5-docker/config/.wine/drive_c/users/abc/Desktop/ReportHi ### Note The HTML report is from **March 15** (3.07% profit). For the **live** current data ($6,935 / 6.94%), use the MT5 terminal directly or the `create-live-report.sh` utility. + +--- + +## Session Update: v1.12 Volatility Filters Added +**Timestamp:** $(date '+%Y-%m-%d %H:%M:%S') + +### Problem Identified +Backtesting analysis showed significant profits followed by drawdowns during narrow trading band periods. When price is in a tight range, breakout signals often result in false breakouts without follow-through. + +### Solution Implemented: Anti-Chop Filters (v1.12) +Added dual volatility filters to block trades during low-volatility/consolidating periods: + +1. **ATR Filter** (`InpUseVolatilityFilter = true`) + - Minimum ATR: 0.5% of current price + - Period: 14 bars + - Blocks: Narrow band / low volatility conditions + +2. **ADX Filter** (`InpUseADXFilter = true`) + - Minimum ADX: 20.0 + - Period: 14 bars + - Blocks: Weak trend / choppy markets + +### Code Changes +```cpp +// NEW: Volatility Filter Inputs (lines 30-36) +input group "=== Volatility Filter (Anti-Chop) ===" +input bool InpUseVolatilityFilter = true; +input int InpATRPeriod = 14; +input double InpMinATRPercent = 0.5; // Min ATR as % of price +input bool InpUseADXFilter = true; +input int InpADXPeriod = 14; +input double InpMinADX = 20.0; // Min ADX (20-25 recommended) + +// NEW: Global handles (lines 46-47) +int ATRHandle; +int ADXHandle; + +// NEW: CheckVolatilityFilter() function (lines 200-223) +// Called before every trade in OnTick() (line 616) +``` + +### Repository Status +- Version: 1.12 +- Commit: 86fa4b2 +- Message: "Add volatility filters v1.12 (Anti-Chop)" +- Status: Pushed to Gitea + +### Expected Impact +- **Reduced:** False breakout trades during consolidation +- **Reduced:** Over-trading in choppy markets +- **Improved:** Win rate (fewer bad trades) +- **Maintained:** Profitable trending market entries