Price Position is (close - rolling_low) / (rolling_high - rolling_low). 1.0 means close pinned to the recent high, 0.0 means
pinned to the low.
It's mathematically identical to a normalized Williams %R on a 0-1 scale.
Formula
hi = max(high, period)
lo = min(low, period)
pos = (close - lo) / (hi - lo)Params
period- window for high/low. Required.
Output
Single column named after your indicator (e.g. price_pos_20).
Usage
- Pullback entry: in an uptrend, enter when
price_pos < 0.4(price has drifted to the lower half of the recent range). - Breakout:
price_pos > 0.95means close is near the recent high. - Filter: skip mean-reversion entries when price position is in the 0.4-0.6 sweet spot - there's no edge to mean-revert toward.
Pitfalls
If the range is degenerate (a flat range bar) the denominator goes to zero. Real markets don't hit this; synthetic test rows can.
