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

# Custom indicators

> Write your own chart indicators for the Hyperprop terminal in Hyperprop Script, a small JavaScript API.

Hyperprop Script lets you build your own indicators for the Hyperprop terminal
charts. A script is **plain JavaScript**, not Pine Script. It declares its
settings at the top level and defines one function, `compute`, that receives
the full bar series and returns everything to draw.

There is no per-bar execution model and no state kept between runs. `compute`
is a pure function of the bars, your settings and any other timeframes the
script requests.

## Create a script

1. In the web terminal, open **Indicators → My scripts → Create script**.
2. Paste or write your script.
3. Choose **Overlay** (drawn over price) or **Separate pane** (its own pane
   below price, with its own value scale).
4. Click **Save & add to chart**.

Compile and runtime errors appear as a red message inside the pane. They never
break the chart. Fix the script and save again. Your scripts sync to your other
devices, including the mobile app.

## Your first script

This script plots a moving average of the close in an overlay pane:

```js theme={null}
const length = input.int('Length', 20, { min: 1, max: 500 });
const color  = input.color('Line color', '#f59e0b');

function compute(bars, inputs, hp) {
  const closes = bars.map(b => b.c);
  return {
    plots: [{ title: 'SMA', values: hp.sma(closes, length), color }],
  };
}
```

The settings dialog is generated from the `input.*` declarations. Changing a
setting re-runs `compute` immediately.

## The script contract

```js theme={null}
// Top level: declare settings and any other timeframes the script needs.
const length = input.int('Length', 14, { min: 1, max: 500 });
const daily  = request.bars('1D');

// Called on every data change with the full series.
function compute(bars, inputs, hp, chart) {
  return {
    plots: [],      // required, may be empty
    boxes: [], labels: [], lines: [], markers: [], bg: [], tables: [], // optional
    range: { min: 0, max: 100 },  // optional: fix a separate pane's scale
    guides: [30, 70],             // optional: dashed horizontal levels
    decimals: 2,                  // optional: axis and legend precision
  };
}
```

| Argument | What it is |
| - | - |
| `bars` | The chart's bars, oldest first: `{ time: Date, o, h, l, c, v? }` |
| `inputs` | The resolved settings values. The declared constants already hold the live values, so you rarely need this. |
| `hp` | Technical analysis helpers. See [TA helpers](https://docs.hyperprop.com/indicators/helpers.md). |
| `chart` | What the chart is showing (also `hp.chart`). See [Chart context](https://docs.hyperprop.com/indicators/chart-context.md). |

`compute` runs again whenever new bars arrive, a setting changes, a requested
timeframe updates, or you switch symbol or timeframe.

## In this section

> **[Inputs](https://docs.hyperprop.com/indicators/inputs.md)**
>
> Settings your script exposes in the dialog.

> **[Plots and drawings](https://docs.hyperprop.com/indicators/plots-and-drawings.md)**
>
> Lines, histograms, boxes, labels, markers and background bands.

> **[Tables](https://docs.hyperprop.com/indicators/tables.md)**
>
> Text tables pinned to a pane corner, with cell alignment.

> **[Chart context](https://docs.hyperprop.com/indicators/chart-context.md)**
>
> Symbol, market, timeframe, tick size and point value.

> **[Other timeframes](https://docs.hyperprop.com/indicators/other-timeframes.md)**
>
> Read daily bars on a 1-minute chart with `request.bars`.

> **[TA helpers](https://docs.hyperprop.com/indicators/helpers.md)**
>
> Moving averages, ATR, RSI, pivots, VWAP and more.

> **[Limits](https://docs.hyperprop.com/indicators/limits.md)**
>
> Execution budget, sandbox and caps.

> **[Examples](https://docs.hyperprop.com/indicators/examples.md)**
>
> Complete scripts you can paste and run.

> **[Porting from Pine Script](https://docs.hyperprop.com/indicators/pine-porting.md)**
>
> Map Pine concepts to Hyperprop Script.

## Using an AI assistant

These pages are the complete reference. Point your AI coding assistant at
them. Every page is also available as plain Markdown by adding `.md` to its
URL, for example
[docs.hyperprop.com/indicators/other-timeframes.md](https://docs.hyperprop.com/indicators/other-timeframes.md).
The index of all pages is at
[docs.hyperprop.com/llms.txt](https://docs.hyperprop.com/llms.txt).


## Related topics

- [Changelog](https://docs.hyperprop.com/changelog.md)
- [Inputs](https://docs.hyperprop.com/indicators/inputs.md)
- [Examples](https://docs.hyperprop.com/indicators/examples.md)
- [Limits](https://docs.hyperprop.com/indicators/limits.md)
- [Plots and drawings](https://docs.hyperprop.com/indicators/plots-and-drawings.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.