ADX regime
Marks each bar 1 (trending) or 0 (ranging) from one bar's push past the prior extremes; not a real ADX.
The name points to the ADX trend-strength indicator, but this is a one-bar shortcut with no averaging. For each bar it takes the larger of two moves, the high's rise above the prior bar's high or the low's drop below the prior bar's low, floored at zero, and divides it by that bar's high-to-low range. Above 25 the bar reads 1 (trending), below 15 it reads 0 (ranging), and anything between is left blank. The window setting is stored but never read.
How to read it
- Drawn in its own pane below the price. It takes only the values 1 and 0, with gaps where it is blank.
- A 1 means the bar pushed past the prior bar's high or low by more than a quarter of its own high-to-low range.
- A 0 means that push stayed under 15% of the range. Inside bars read 0.
- At default settings on SPY one-minute bars the line is mostly 1 with gaps, so a flat line at 1 is the normal picture and says little.
What it outputs
- Regime: 1 trending, 0 ranging
- 1 when the bar's high rose past the prior high, or its low fell past the prior low, by over 25% of its range. 0 when that push is under 15%. Blank in between, on flat bars and on the first bar.
Settings
- window
- Has no effect. The value is stored on the indicator, but the calculation never reads it, so raising or lowering it leaves the line unchanged.
Pitfalls
- It is not ADX. Nothing is averaged or smoothed, so the reading is set by a single bar and can flip from 1 to 0 on the next bar.
- At default settings the line is blank on about a quarter of bars and reads 1 on most of the rest, with a correlation to close near zero (0.007 on SPY, September 2026). It carries little signal as drawn.
- The docstring describes 'trending' and 'ranging' text labels with ranging below 20. The code returns 1 or 0 and calls ranging below 15, so trust the code.