XAUUSD M5 trend pullback self-test, 2026-10-28T13:25:57.703Z 1. EMAs, the 1-hour trend, the window [ok] EMA(3) of 1..6: undefined, then the mean of the first three (2), then 3, 4, 5 (factor 0.5) [ok] flat 1-hour closes equal to their EMA 200: no trend; a 5-minute bar at :30 still reads the last closed hour (none); the hour closing at 101.50 above its EMA turns the trend long at its own close [ok] window: 03:00-11:30 New York; 04:00 in the March and late-October weeks of 2024; 02:00 in late March 2006 (the US changed in April then) 2. Hand-made days (EMA 20 = 1999, EMA 50 = 1990, 1-hour trend long, unless stated) A. the base long: pullback at 05:05, confirmation at 05:15, entry 2001.80 at 05:16, stop 1997.70, R 4.10 [ok] 1.5R: target 2007.95 at 05:29, 5.85 $/oz [ok] 2R: target 2010 never reached, out at 11:30 at 2008 (5.90 $/oz) [ok] no short while the 1-hour trend is long B. the pullback window and the confirmation candle [ok] the pullback on the confirmation bar itself (low 1998.50): stop 1998.50 - 0.30 [ok] the only touch three bars before the green bar (05:00 for 05:15): no signal [ok] a red confirmation bar, or a close (2001.80) under its EMA 20 (2002): no signal [ok] EMA 20 under EMA 50: no signal C. the minimum stop [ok] stop 1999.90, R $1.90: no trade with the $2.00 minimum (the stop is not widened); taken with no minimum D. exits [ok] stop and target in one minute: the stop (-1R - $0.30) [ok] a minute opening below the stop exits at its open (1996) E. frequency, the window edges, coverage [ok] a second valid signal at 07:15 the same day is not traded (alone, it would be) [ok] a confirmation bar closing at 03:00 (opened at 02:55) is before the window; one closing at 03:05 is the first possible [ok] a day missing 06:01-08:00 (390 of 510 window minutes, under 80%) is skipped F. a short (the base day turned upside down around 2000) [ok] short: entry 1998.20, stop 2002.30, target 1992.05 (5.85 $/oz) 3. The reference (mtp_ref.js) against the engine [ok] the window of every day from June 2004 to October 2026: time-zone database = written-out rules (differences 0) [ok] corrected clock, MTP-L-1.5R: 2423 trades; trades differing 0 [ok] corrected clock, MTP-L-2R: 2423 trades; trades differing 0 [ok] corrected clock, MTP-S-1.5R: 1988 trades; trades differing 0 [ok] corrected clock, MTP-S-2R: 1988 trades; trades differing 0 [ok] uncorrected clock, MTP-L-1.5R: 2423 trades; trades differing 0 [ok] uncorrected clock, MTP-L-2R: 2423 trades; trades differing 0 [ok] uncorrected clock, MTP-S-1.5R: 1989 trades; trades differing 0 [ok] uncorrected clock, MTP-S-2R: 1989 trades; trades differing 0 4. The control at offset 0 on the real data [ok] MTP-L-1.5R: offset 0 reproduces all 2423 trades (differences 0) [ok] MTP-L-2R: offset 0 reproduces all 2423 trades (differences 0) [ok] MTP-S-1.5R: offset 0 reproduces all 1988 trades (differences 0) [ok] MTP-S-2R: offset 0 reproduces all 1988 trades (differences 0) PASSED