Math Operators

Index of Highest Value (Bars Since High) (MAXINDEX)

Index of highest value over a specified period

Deep Dive

Everything You Need to Know

Under the Hood

How It Works

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

How Traders Use It

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.

Highlights

MAXINDEX at a Glance

Returns bars since highest value
0 = current bar is period high
Higher values = time since high
Default 30-period lookback
Measures recency of peak prices
Useful for momentum and consolidation detection

Get Started

Automate MAXINDEX with cryptorobot.ai

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.