> ## Documentation Index
> Fetch the complete documentation index at: https://takeprofit.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Volume Footprint profiles

> Request Volume Footprint profiles in Indie. Calculate buy-sell delta and find the highest-volume price row.

Volume Footprint profiles split traded volume and trade counts into buy and sell sides at each price row. Indie
exposes them as a typed `Series[VolumeFootprintProfile]`, so an indicator can use both profile totals and the detailed
rows.

Volume Footprint is platform-provided data for the instrument of the current chart. It needs no URL or user-defined
schema and does not make the indicator an external-data indicator.

## Plot buy-sell volume delta

This indicator requests five-minute profiles for the main trading session and plots the total buy volume minus the
total sell volume:

```py Volume Footprint delta theme={null}
# indie:lang_version = 5
from indie import (
    indicator,
    MainContext,
    request_series,
    Series,
    TimeFrame,
    plot,
    color,
)
from indie.data import VolumeFootprintProfile
from indie.data import sources
from indie.data.sources import session_types


@indicator('Volume Footprint delta')
@plot.columns(title='Buy - sell volume')
class Main(MainContext):
    def __init__(self):
        self._footprints: Series[VolumeFootprintProfile] = (
            request_series[VolumeFootprintProfile](
                source=sources.VolumeFootprint(
                    session_types=[session_types.MAIN_SESSION],
                    row_size_ticks=0,
                ),
                time_frame=TimeFrame.from_str('5m'),
            )
        )

    def calc(self):
        profile = self._footprints[0]
        delta = profile.total_volume_buy - profile.total_volume_sell

        column_color = color.GREEN
        if delta < 0.0:
            column_color = color.RED

        return plot.Columns(delta, color=column_color)
```

The required `time_frame` belongs to `request_series`, not to the source. Volume Footprint accepts positive minute and
hour time frames, plus exactly `1D`, `1W` and `1M`. Seconds, ticks and multi-day, multi-week or multi-month values such
as `2D`, `2W` and `2M` are not supported. In historical calculation, profiles are aligned by their end time: on each
chart bar, `[0]` is the latest completed profile available at that time, and larger offsets access earlier profiles.
After the indicator switches to live data, `[0]` is updated when the current profile receives new trades, including
before its `profile_end_unix_seconds`.

<Note>
  Volume Footprint always uses the instrument of the chart where the indicator is running. It cannot be used to select
  another exchange or ticker.
</Note>

## Find the highest-volume price row

Each profile contains price rows ordered from low to high. This example finds the row with the greatest combined buy
and sell volume and plots its price as a line on the main chart:

```py Volume Footprint highest-volume price theme={null}
# indie:lang_version = 5
from math import nan

from indie import (
    indicator,
    MainContext,
    request_series,
    Series,
    TimeFrame,
    plot,
    color,
)
from indie.data import VolumeFootprintProfile
from indie.data import sources


@indicator('Volume Footprint highest-volume price', overlay_main_pane=True)
@plot.line(title='Highest-volume price', color=color.BLUE)
class Main(MainContext):
    def __init__(self):
        self._footprints: Series[VolumeFootprintProfile] = (
            request_series[VolumeFootprintProfile](
                source=sources.VolumeFootprint(),
                time_frame=TimeFrame.from_str('5m'),
            )
        )

    def calc(self):
        profile = self._footprints[0]
        if len(profile.rows) == 0:
            return nan

        first_row = profile.rows[0]
        highest_volume = first_row.volume_buy + first_row.volume_sell
        highest_volume_price = first_row.price

        for row in profile.rows:
            row_volume = row.volume_buy + row.volume_sell
            if row_volume > highest_volume:
                highest_volume = row_volume
                highest_volume_price = row.price

        return highest_volume_price
```

`sources.VolumeFootprint()` includes the main session, pre-market and post-market by default. Pass enum values from
`indie.data.sources.session_types` to select a subset. String names such as `'MAIN_SESSION'` are not supported; use
`session_types.MAIN_SESSION` instead. Selected session types are always combined into one profile for each requested
period, so Volume Footprint has no separate merge-policy argument.

`row_size_ticks` must be a non-negative integer. `row_size_ticks=0` lets the service choose the price grid
automatically. A positive value requests a row height in instrument ticks; the exact resulting `row_size` is
available on every profile.

For the complete source signature and all read-only profile and row fields, see
[`sources.VolumeFootprint`](/docs/indie/Library-reference/package-indie-data-sources#class_VolumeFootprintSource) and
[`VolumeFootprintProfile`](/docs/indie/Library-reference/package-indie-data#class_VolumeFootprintProfile) in the Library
Reference.
