Two of twenty-nine divergence pairs had a first pivot outside the 500-bar window
On EURUSD M1, after 21 new closed bars, a remove and reattach of my divergence scanner returned the same 47 marks in name, time and price. The footer count did not hold: 29 regular or hidden in 500 bars before, 27 after. Two of those pairs had a first pivot outside the new window.
The arithmetic is small. The forming bar is rates_total - 1, every loop over bars ends at rates_total - 2, and a pivot at i is confirmed only when rates_total - 2 - i reaches the right count, 3 at the default. The tester printed a hidden bearish pair with its second pivot at 14:00 and confirmation at 18:00, four H1 bars later.
Hidden is the second class, read off the same two closed bars: a higher low against a lower reading, a lower high against a higher one, and the line that confirmed one printed 41.3 then 42.2. Regular is the low that undercuts with a higher reading, or the high that exceeds with a lower one.
Do the pruning at the window's left edge. Before a new pivot is tested, drop the pairs whose first pivot sits beyond that edge plus the left count, and let the footer count only the pairs inside it. My first build skipped that, so the count drifted while the marks held still.
EURUSD H1 and M1, two demo installs, builds 6361 and 6331, oscillators computed in-file. A terminal that reloads the series with older history reseeds them, and a reading can move in the last decimals.


