Internal Bar Strength (IBS)

Calculate the Internal Bar Strength (IBS): where the close lies within the range of its period, from 0 (at the low) to 1 (at the high).

The Internal Bar Strength is where the close sits within the period’s own range: 0 for a close on the low, 1 for a close on the high. It is a mean-reversion measure: in equity indices and ETFs a close near the low of the day (an IBS below about 0.2) has tended to be followed by higher returns the next day, and a close near the high (above about 0.8) by lower returns.

The formula is as follows:

\[\text{IBS} = \frac{\text{Close} - \text{Low}}{\text{High} - \text{Low}}\]

Also known as: IBS, internal bar strength.

Example · SPY, QQQ · 2021 to 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_internal_bar_strength:

from financetoolkit import Toolkit

toolkit = Toolkit(
    tickers=["SPY", "QQQ"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.technicals.get_internal_bar_strength()

Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:

Where in its daily range did the Invesco QQQ ETF close on each day of 2025, compared with the SPDR S&P 500 ETF?

Which returns:

Parameters

get_internal_bar_strength accepts the following parameters.

ParameterTypeDescriptionExample
periodstrThe time period to consider for historical data. Options are: “intraday” (intraday prices), “daily” (daily prices), “weekly” (weekly prices), “monthly” (monthly prices), “quarterly” (quarterly prices), “yearly” (yearly prices). Defaults to “daily”."weekly"
close_columnstrThe column name for closing prices in the historical data. Defaults to “Adj Close”, in which case the open, high and low prices are adjusted for dividends in the same way."Close"
roundingint | NoneThe number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise).2
growthboolWhether to calculate the growth of the indicator values. Defaults to False.True
lagint | list[int]The lag to use for the growth calculation. Defaults to 1.4
standardizeboolWhether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.True
show_columnsstr | list[str] | NoneThe columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column.None, which keeps every column

References

  • Paper Pagonidis, A.S. (2014). “The IBS Effect: Mean Reversion in Equity ETFs.” NAAIM Founders Award paper.
  • Library Referenced against TA-Lib’s IBS
Share