ADX + DI self-test, 2026-10-21T12:38:29.929Z Note: in the first run the control at offset 0 failed on all 8 pair-variants: a trade opened by a flip (on the bar where the previous one exits) was treated as overlapping it and dropped; fixed in adx_lib.js controlTrades before any result was printed. 1. Indicator: Wilder TR, DM, sums, DI, DX and ADX against a literal recomputation (40 bars) [ok] DI and DX: +DI(14) 23.0788, -DI(20) 17.7770, DX(30) 19.6434 [ok] ADX starts at bar 27 (9.6692), bar 39 8.7325 2. Trade rules on a hand-made indicator path (one minute per bar, prices 1 + k x 0.0001) [ok] long 506 -> 511: +5 pips gross, 4.00 net [ok] short 515 -> 518 (no entry at 513: ADX equal to 20), net -4.00 [ok] flip to long at the same fill (518), held to the end and closed at the last close [ok] control: offset 0 = the two closed trades; offset 3 moves them 3 bars later, same lengths 3. Real data: engine against the independent reference (8 pair-variants) EURUSD: 8326700 minutes, 141042 hourly bars, 2004-01-01 00:03 .. 2026-09-28 15:46 [ok] EURUSD ADX-20: 2207 trades, reference 2207, identical [ok] EURUSD ADX-20: control at offset 0 = the 2207 closed real trades [ok] EURUSD ADX-25: 2171 trades, reference 2171, identical [ok] EURUSD ADX-25: control at offset 0 = the 2171 closed real trades GBPUSD: 8297247 minutes, 141014 hourly bars, 2004-01-01 00:05 .. 2026-09-28 15:46 [ok] GBPUSD ADX-20: 2221 trades, reference 2221, identical [ok] GBPUSD ADX-20: control at offset 0 = the 2220 closed real trades [ok] GBPUSD ADX-25: 2104 trades, reference 2104, identical [ok] GBPUSD ADX-25: control at offset 0 = the 2104 closed real trades USDJPY: 8311500 minutes, 140969 hourly bars, 2004-01-01 00:09 .. 2026-09-28 15:46 [ok] USDJPY ADX-20: 2349 trades, reference 2349, identical [ok] USDJPY ADX-20: control at offset 0 = the 2349 closed real trades [ok] USDJPY ADX-25: 2189 trades, reference 2189, identical [ok] USDJPY ADX-25: control at offset 0 = the 2188 closed real trades AUDUSD: 8181339 minutes, 139969 hourly bars, 2004-01-01 00:41 .. 2026-09-28 15:46 [ok] AUDUSD ADX-20: 2375 trades, reference 2375, identical [ok] AUDUSD ADX-20: control at offset 0 = the 2375 closed real trades [ok] AUDUSD ADX-25: 2245 trades, reference 2245, identical [ok] AUDUSD ADX-25: control at offset 0 = the 2245 closed real trades PASSED