> ## 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.

> Use your own data in Indie indicators. Overview of external CSV data sources, the three ways to consume them, and how external data is fetched.

# External data overview

Indicators normally work with market data that the platform provides. External data sources let an indicator also
use data you bring yourself: your own candle series, trading signals, ML model outputs, risk factors or any other
time-stamped values.

You publish the data as a CSV file at a public HTTPS URL and declare it in the indicator code with a source
descriptor:

```py theme={null}
from indie.data import sources

sources.Csv('https://example.com/data.csv')
```

TakeProfit servers download and validate the file and deliver its rows to your indicator. The Indie code itself never
performs any network or file I/O — it only declares the dependency and reads ready-made values, the same way it reads
market data.

## Three ways to use external data

What you write depends on what is in the file:

* If the file contains OHLCV candles, write a `@sec_context` callback and attach it with
  `Context.calc_on(source=...)`, the same way you attach an additional instrument. See
  [External candles from CSV](/docs/indie/External-data/External-candles-from-CSV).
* If the rows have their own shape and each row needs processing, describe the row with a `@dataclass` and write a
  `@data_context` callback for `Context.calc_on(source=...)`. See
  [Typed external data](/docs/indie/External-data/Typed-external-data).
* If you only need the latest row value on each chart bar, skip the callback and read the rows directly with
  `request_series[T](source=...)`.

## Quick example

This indicator plots the daily close prices from an external candle CSV on any chart:

```py External candle close theme={null}
# indie:lang_version = 5
from indie import indicator, sec_context, MainContext, TimeFrame
from indie.data import sources

@sec_context
def ExternalCandles(self):
    return self.close[0]

@indicator('External candle close')
class Main(MainContext):
    def __init__(self):
        self._ext_close = self.calc_on(
            ExternalCandles,
            time_frame=TimeFrame.from_str('1D'),
            source=sources.Csv('https://example.com/candles.csv'))

    def calc(self):
        return self._ext_close[0]
```

## The data is a snapshot

The file is fetched once, when the indicator instance is created. After that the data is frozen: the indicator works
with the file's history and receives no live updates, even if the file changes on your server. To pick up a new
version, re-add the indicator to the chart. A cached copy may be served for up to about 10 minutes after the previous fetch.

<Note>
  The platform does not archive your file. If it changes, the next run of the indicator or backtest can see different
  data. Keep a stable copy of the file if you need reproducible backtests.
</Note>

## Rules common to all external sources

* External sources count toward the same limit as additional instruments requested with `Context.calc_on()`.
  Identical requests are counted once; a request that differs in URL, `time_column`, time frame or `lookahead`
  counts as a separate instrument.
* The time frame belongs to the call site, not to the file: you pass `time_frame=` to `Context.calc_on()` or
  `request_series()`. For candle CSVs it is required, for typed data it is optional, and tick time frames are not
  supported.
* The file must be a public HTTPS URL with a valid certificate; authentication headers cannot be sent. See
  [CSV format and limits](/docs/indie/External-data/CSV-format-and-limits) for the full requirements, size limits and
  error reference.

<Note>
  Indicators that use external data sources cannot be published to the TakeProfit marketplace.
</Note>
