Double top engine self-test 2026-11-11T19:30:49.862Z [PASS] volatility by hand (window 3): s(t) is the sample standard deviation of the log changes of bars t-3 .. t-1, undefined before bar 4 [PASS] volatility: the default window is 500 bars [PASS] zigzag by hand: pivots and the bars that confirm them (3% cut-off): T1@3 P6@8 T11@13 P16@18 T21@23 P26@28 T36@39 [PASS] double top by hand: valid (a higher high and a higher low before it; tops 115 and 115.5 within 0.9%), found when the second top is confirmed: 1:16-26 [PASS] double top by hand: valley floor N = the lowest LOW of bars 16..26 (a wick of 103.8), top = the highest HIGH (a wick of 117), height 13.2: N 103.8 top 117 h 13.200000000000003 [PASS] double top by hand: break at the first close below N (bar 32, close 103.2); target N - h = 90.6; stop = highest high of bars 22..32 (116, the wick of bar 20 is before the valley): b 32 target 90.6 stop 116 [PASS] pattern rule 1 by hand: no higher high before it (the earlier peak, 118, is above the first top, 115) -> rejected: rule failed: 1 [PASS] pattern rule 1 by hand: no higher low before it (the earlier trough, 106, is above the valley, 105) -> rejected: rule failed: 1 [PASS] pattern rule 0 by hand: second top 0.89% above the first (inside 0.3 x 3 x 1% = 0.9%) -> accepted: rule failed: 0 [PASS] pattern rule 2 by hand: second top 0.91% above the first -> rejected: rule failed: 2 [PASS] pattern rule 2 by hand: second top 0.91% below the first -> rejected: rule failed: 2 [PASS] the tolerance scales with k and s: tops 0.43% apart fail with k x s = 1.2% (tolerance 0.36%) and pass with k x s = 1.5% [PASS] time limit: the first close below N at bar 36, 10 bars after the second top (as many as from the first top) -> dropped: b -1 [PASS] time limit: the first close below N at bar 35 (9 bars after) -> taken: b 35 [PASS] the next pivot (a trough at 108, confirmed at bar 35 before any close below N) ends the pattern -> dropped: b -1 [PASS] a close below N on the bar that confirms the second top: the break is that bar: conf 27 b 27 [PASS] double bottom by hand (the mirror image): N = highest high 95.5, bottom = lowest low 84, height 11.5, break above N at bar 32, target 107, stop = lowest low of bars 22..32 (84): N 95.5 bottom 84 h 11.5 b 32 target 107 stop 84 [PASS] stop and target in the same minute: the stop is taken [PASS] a stop gapped through fills at the minute's open (98, not 99) [PASS] a target gapped through fills at the open (103, not 102) [PASS] the stop can be hit in the entry minute [PASS] short: the stop (101) is above, taken first when both are touched [PASS] no level touched: closed at the last minute's close, flagged [PASS] entry at the open of the first minute after the break bar; a break while a position is open is not taken; a break in the bar where the previous trade ended is taken: 1:11-26 -1:31-34 1:51-60 [PASS] no trade when the entry is at the target (100) or at the stop (100); such a break blocks nothing (the next break on the same bar is taken): {"target":1,"stop":1,"busy":1} [PASS] long only ignores double tops: 1:11-26 1:51-60 [PASS] result in R: (direction x (exit - entry) - $0.30) / height; financing scenarios A (3% a year) and B (swap of 2026-10-12) [PASS] distances kept for the control: to the stop and to the target from the fill [PASS] synthetic DT-LS-3: engine and re-implementation agree trade by trade, and on the patterns found and broken: 73 vs 73 trades, 0 differences; patterns 146 vs 146, breaks 75 vs 75 [PASS] synthetic DT-L-3: engine and re-implementation agree trade by trade, and on the patterns found and broken: 33 vs 33 trades, 0 differences; patterns 146 vs 146, breaks 75 vs 75 [PASS] synthetic DT-LS-6: engine and re-implementation agree trade by trade, and on the patterns found and broken: 27 vs 27 trades, 0 differences; patterns 46 vs 46, breaks 30 vs 30 [PASS] synthetic DT-L-6: engine and re-implementation agree trade by trade, and on the patterns found and broken: 12 vs 12 trades, 0 differences; patterns 46 vs 46, breaks 30 vs 30 [PASS] synthetic: the control at offset 0 reproduces the real trades: 73 of 73 [PASS] synthetic: double tops give shorts and double bottoms longs; long only never shorts real data: 7067434 minutes, 129857 one-hour bars, 2004-06-11 01:19 .. 2026-10-07 16:57 New York (audit clock); patterns found k=3: 383 (broken 159), k=6: 141 (broken 63) [PASS] real data: the 1-hour bars equal a naive aggregation of the minutes (every 251st bar): 518 bars checked, 0 differences [PASS] real data: the volatility equals a naive recomputation (every 1001st bar): 0 differences [PASS] DT-LS-3: engine and independent re-implementation agree on every zigzag pivot, pattern, break and trade: 151 vs 151 trades, 0 differences; pivots 5588 vs 5588; patterns 383 vs 383; breaks 159 vs 159 [PASS] DT-LS-3: control at offset 0 reproduces the real trades: 151 of 151, 0 differences [PASS] DT-L-3: engine and independent re-implementation agree on every zigzag pivot, pattern, break and trade: 75 vs 75 trades, 0 differences; pivots 5588 vs 5588; patterns 383 vs 383; breaks 159 vs 159 [PASS] DT-L-3: control at offset 0 reproduces the real trades: 75 of 75, 0 differences [PASS] DT-LS-6: engine and independent re-implementation agree on every zigzag pivot, pattern, break and trade: 60 vs 60 trades, 0 differences; pivots 2013 vs 2013; patterns 141 vs 141; breaks 63 vs 63 [PASS] DT-LS-6: control at offset 0 reproduces the real trades: 60 of 60, 0 differences [PASS] DT-L-6: engine and independent re-implementation agree on every zigzag pivot, pattern, break and trade: 31 vs 31 trades, 0 differences; pivots 2013 vs 2013; patterns 141 vs 141; breaks 63 vs 63 [PASS] DT-L-6: control at offset 0 reproduces the real trades: 31 of 31, 0 differences [PASS] no look-ahead: on the data cut at the end of a bar (4 cuts), every pivot, pattern and trade completed before the cut is the same as on the full data: cut after 2011-04-19 06:00: 123 closed trades compared; cut after 2016-11-03 08:00: 189 closed trades compared; cut after 2022-05-12 16:00: 256 closed trades compared; cut after 2025-08-27 22:00: 297 closed trades compared [PASS] every broken pattern: its five pivots confirmed one after another, the second top confirmed after it formed, the break at or after that confirmation; every entry after the break bar closed: 222 patterns, 0 out of order [PASS] hole windows: every end is the same minute (index) on gx_lib's clock and on the audit clock; labels differ only by the 0/60-minute moves: 2099 windows, 0 bad ends window 0: uncorrected 2004-06-11 06:54, gx clock 2004-06-11 06:54, audit clock 2004-06-11 07:54 window 420: uncorrected 2005-07-22 12:41, gx clock 2005-07-22 12:41, audit clock 2005-07-22 13:41 window 840: uncorrected 2006-10-16 16:42, gx clock 2006-10-16 16:42, audit clock 2006-10-16 16:42 window 1260: uncorrected 2008-07-22 16:17, gx clock 2008-07-22 16:17, audit clock 2008-07-22 17:17 window 1680: uncorrected 2010-11-11 04:04, gx clock 2010-11-11 04:04, audit clock 2010-11-11 05:04 PASSED