Index of highest value over a specified period
Under the Hood
MAXINDEX returns the number of bars ago (index) where the highest value occurred within the lookback period (default 30). Instead of returning the maximum value like MAX, it returns how long ago that maximum was reached. Output of 0 means the current bar is the high; output of 15 means the high was 15 bars ago. This quantifies recency of highs.
In Practice
Traders use MAXINDEX to measure time since recent high, useful for detecting momentum fading or consolidation periods. When MAXINDEX increases, price is moving further from recent highs (potential weakening). When MAXINDEX = 0, price just reached a new period high (potential breakout). MAXINDEX is valuable for regime detection and timing entry after pullbacks from highs.
Build automated strategies using Index of Highest Value (Bars Since High) and hundreds of other indicators. Connect to your favourite exchange and let the bot execute trades 24/7 — no code required.