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

# Inputs

> Declare the settings your indicator shows in its settings dialog.

Declare inputs at the top level of your script. Each declaration returns the
resolved live value, so you can use the constant directly inside `compute`.
The settings dialog is generated from these declarations.

```js theme={null}
const length = input.int('Length', 14, { min: 1, max: 500 });
const mult   = input.float('Multiplier', 2, { min: 0.1, max: 10, step: 0.1 });
const show   = input.bool('Show labels', true);
const color  = input.color('Line color', '#f59e0b');
const mode   = input.select('Mode', 'fast', ['fast', 'slow']);
const src    = input.source('Source', 'close');
```

## Declarations

| Declaration | Returns |
| - | - |
| `input.int(label, default, opts?)` | integer |
| `input.float(label, default, opts?)` | number |
| `input.bool(label, default?)` | boolean |
| `input.color(label, default)` | color string (hex or `rgba()`) |
| `input.string(label, default?)` | string |
| `input.select(label, default, choices)` | string. `choices` is `string[]` or `{ value, label }[]`. |
| `input.source(label?, default?)` | one of `open`, `high`, `low`, `close`, `hl2`, `hlc3`, `ohlc4` |

`opts` is `{ key?, min?, max?, step? }`.

## Keeping saved settings stable

Each input is stored under a key. The key defaults to a slug of the label. If
you might rename a label later, pass a fixed `key` so traders keep their saved
values:

```js theme={null}
const length = input.int('Lookback length', 14, { key: 'length', min: 1 });
```

## Using a source input

`input.source` returns the name of a price field. Map it to values yourself:

```js theme={null}
const src = input.source('Source', 'close');

function compute(bars, inputs, hp) {
  const pick = {
    open: b => b.o, high: b => b.h, low: b => b.l, close: b => b.c,
    hl2: b => (b.h + b.l) / 2,
    hlc3: b => (b.h + b.l + b.c) / 3,
    ohlc4: b => (b.o + b.h + b.l + b.c) / 4,
  }[src];
  return { plots: [{ title: 'EMA', values: hp.ema(bars.map(pick), 21) }] };
}
```


## Related topics

- [Custom indicators](https://docs.hyperprop.com/indicators/overview.md)
- [Add accounts to a draft preview](https://docs.hyperprop.com/platform-api/mass-credit/add-accounts-to-a-draft-preview.md)
- [Porting from Pine Script](https://docs.hyperprop.com/indicators/pine-porting.md)
- [Get a specific trading account](https://docs.hyperprop.com/platform-api/trading-accounts/get-a-specific-trading-account.md)
- [TA helpers](https://docs.hyperprop.com/indicators/helpers.md)


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