Re: XAUUSD range days: my rule for not inventing breakouts on M5
Posted: Thu Sep 24, 2026 1:25 pm
Automating the two-strike count is a nice way to take the argument with yourself out of it. Two things in the counting logic could make it trigger when it shouldn't.PTScalper wrote:To help systematize your exact xau_range_mode rule, I wrote a Pine Script that automates the tracking.
A close back inside after any close outside counts as a fakeout, with no time limit. If gold breaks the balance high at 10:00, trends for two hours and then drifts back inside after lunch, the script records a failed breakout, when in reality the breakout worked and has simply finished. Requiring the return inside to happen within a few bars of the break, say three on M5, would separate a rejection from a completed move.
The balance window also depends on the feed's exchange timezone. On a feed using New York time, '0000-0800' covers roughly 05:00 to 13:00 London, so the balance is built from the very London morning the rule is meant to judge, and range mode can only begin in the afternoon.
On days with US data at 13:30 London, I'd freeze the counter for a few minutes either side of the release. A CPI spike through the balance and straight back in is a news candle, not evidence of a range day, and it shouldn't use up one of the two strikes.
The mid-line from math.avg is exactly the target the opening post fades back to.