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

# What you can build with Indie

> Six things a scripting language makes possible on a chart: your own CSV data, on-chart summary tables, cross-instrument calculations, custom bar coloring, trading sessions, and strategies with orders.

Six capabilities you do not get from a fixed indicator library. Each one is a few lines of Indie, and each example
below is taken from a page in this documentation where it is explained in full.

New to the language? [Why Indie](/docs/indie/Why-Indie) covers the reasoning; [Quick start](/docs/indie/Quick-start) covers
the first script.

***

## 1. Your own data next to price

Macro figures, on-chain metrics, funding rates, your own trading journal — anything you can publish as a CSV over
HTTPS becomes a series on the chart, read as candles, as typed rows, or directly with `request_series`.

```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]
```

No exchange offers this, because it is not exchange data. It is yours.

<Note>
  Scripts using external data cannot be published to the Marketplace — they stay private to your account.
</Note>

[External data →](/docs/indie/External-data/External-data-overview)

***

## 2. A summary that stays on the chart

Session statistics, current values, signal counts, risk numbers — in a table pinned to a corner of the chart, so the
reader does not have to hover over a line to find them.

```py Market summary table theme={null}
# indie:lang_version = 5
from indie import MainContext, color, indicator
from indie.drawings import Table, TableCell, TableRow, RelativePosition, vertical_anchor as va, horizontal_anchor as ha

@indicator('Market summary', overlay_main_pane=True)
class Main(MainContext):
    def __init__(self):
        self._table = Table(
            position=RelativePosition(va.TOP, ha.RIGHT, 0.05, 0.95),
        )

    def calc(self):
        if not self.is_last_bar:
            return self.close[0]

        self._table.clear()
        self._table.append(TableRow([
            TableCell('Metric', bg_color=color.GRAY(0.5)),
            TableCell('Value', bg_color=color.GRAY(0.5)),
        ]))
        self._table.add_row(['Close', str(self.close[0])])
        self._table.add_row(['Bar', str(self.bar_index)])

        self.chart.draw(self._table)
        return self.close[0]
```

Tables hold up to 50 rows and 20 columns.

[Drawings: lines, labels, tables →](/docs/indie/Plotting-and-drawing/Drawings-lines-labels)

***

## 3. Another instrument, or a faster timeframe

An indicator on the hourly chart can calculate its logic on the minute chart, or pull the daily high and low of a
different instrument. `Context.calc_on()` runs a second context and merges the result into your timescale.

```py Minimal calc_on example theme={null}
# indie:lang_version = 5
from indie import indicator, MainContext, sec_context, param

@sec_context
def SecMain(self):
    return self.high[0], self.low[0]

@indicator('Minimal calc_on example', overlay_main_pane=True)
@param.time_frame('sec_time_frame', default='1D')
class Main(MainContext):
    def __init__(self, sec_time_frame):
        self._sec_high, self._sec_low = self.calc_on(SecMain, time_frame=sec_time_frame)

    def calc(self):
        return self._sec_high[0], self._sec_low[0]
```

Higher and lower timeframes are both supported — lower ones since v5.14.

[Request additional instruments →](/docs/indie/Request-additional-instruments)

***

## 4. Candles coloured by your own rule

Instead of a signal in a separate pane that you have to correlate with price by eye, colour the bars themselves —
volume spikes, trend shifts, whatever your rule says.

```py Volume Spike Bar Color theme={null}
# indie:lang_version = 5
from indie import indicator, param, plot, color
from indie.algorithms import Sma


@indicator('Volume Spike Bar Color', overlay_main_pane=True)
@param.int('volume_ma_len', default=20, min=1, title='Volume MA Length')
@param.float('spike_coef', default=2.0, min=1.0, max=1000.0, title='Spike coefficient')
@plot.bar_color(title='Bar Color')
def Main(self, volume_ma_len, spike_coef):
    volume_ma = Sma.new(self.volume, volume_ma_len)
    spike = self.volume[0] > volume_ma[0] * spike_coef

    # Color bars with high volume in yellow, others use default coloring
    return plot.BarColor(color.YELLOW if spike else None)
```

Returning `None` leaves the bar with its default colour.

[Data plotting →](/docs/indie/Plotting-and-drawing/Data-plotting-lines-columns-etc)

***

## 5. Your own trading sessions

Market hours differ by venue, and most rules only make sense inside a session. A schedule is a set of rules with a
timezone and its own exceptions, and any bar can be tested against it.

```py Session schedule theme={null}
# indie:lang_version = 5
from indie import indicator, MainContext
from indie.schedule import ScheduleRule, Schedule, WORKDAYS, WEEKEND
from datetime import time, datetime

@indicator('Example')
class Main(MainContext):
    def __init__(self):
        rule1 = ScheduleRule(start=time(hour=9), end=time(hour=18), days=WORKDAYS)
        rule2 = ScheduleRule(start=time(hour=12), end=time(hour=15), days=WEEKEND)
        self.schedule = Schedule(rules=[rule1, rule2], except_once=[datetime(year=2025, month=4, day=5)], timezone="America/New_York")

    def calc(self):
        # using self.schedule, e.g.
        return 1 if self.time[0] in self.schedule else 0
```

Overnight sessions, 24/7 markets and single-day exceptions are all covered.

[Schedules and trading sessions →](/docs/indie/Schedules-and-Trading-Sessions)

***

## 6. Rules that place orders — and get tested

An indicator that places orders is a strategy. The same file that drew your signal can open, reverse and close a
position, then be measured over history in the [Strategy tester](/docs/guide/platform/backtesting-widget/backtest-widget).

```py Inside Bar strategy theme={null}
# indie:lang_version = 5
from indie import strategy, param
from indie.strategies import order_side


@strategy('InSide Bar Strategy', overlay_main_pane=True, initial_capital=4200000.0)
@param.float('order_size', default=10.0, title='Order size', min=0.1, max=100.0)
@param.str('order_size_unit', default='% of cash', title='Order size unit', options=['% of cash', 'quantity'])
def Main(self, order_size, order_size_unit):
    desired_pos_size = order_size if order_size_unit == 'quantity' else self.trading.cash * order_size / 100 / self.close[0]
    if self.high[0] < self.high[1] and self.low[0] > self.low[1]:
        pos_size = self.trading.position.size
        if self.close[0] > self.open[0] and pos_size <= 0:
            # reverse previous position if exists or open a new one
            self.trading.place_order(order_side.BUY, size=desired_pos_size + abs(pos_size)).submit()
        elif self.close[0] < self.open[0] and pos_size >= 0:
            self.trading.place_order(order_side.SELL, size=desired_pos_size + abs(pos_size)).submit()
```

Limit and stop prices, take profit, stop loss, amend and cancel are all available on the order builder.

[Strategies and backtesting →](/docs/indie/Strategies/Strategies-overview)

***

## Where to go next

<CardGroup cols={3}>
  <Card title="Quick start" icon="play" href="/docs/indie/Quick-start">
    Your first indicator, step by step.
  </Card>

  <Card title="Build it with AI" icon="robot" href="/docs/guide/platform/ai-assistant/Mcp-server-guide">
    Describe the idea and let an LLM write and validate the Indie code.
  </Card>

  <Card title="Code examples" icon="file-code" href="/docs/indie/Code-examples/educational-indicators">
    Longer, ready-to-run indicators and strategies.
  </Card>
</CardGroup>
