> For the complete documentation index, see [llms.txt](https://fto-2.gitbook.io/fto-indicators-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fto-2.gitbook.io/fto-indicators-docs/external_parameters_definition/reg-option.md).

# RegOption

Registers a new option parameter for an indicator or strategy.

## Syntax

```typescript
RegOption(name: string, type: TOptionType, optPtrOrValue?: string | number | boolean | TOptValue, inv = true, useInNameWithParams = true, tab = TOptionTab.INPUTS): void
```

## Parameters

* `name` - A string containing the name of the option.
* `type` - The type of the option (from [TOptionType](/fto-indicators-docs/types/option-type.md) enum).
* `optPtrOrValue` - (Optional) The default value for the option.
* `inv` - (Optional) Visibility flag, defaults to true.
* `useInNameWithParams` - (Optional) Whether to include this option in the name with parameters, defaults to true.
* `tab` - (Optional) The tab to display the option in (from [TOptionTab](/fto-indicators-docs/types/option-tab.md) enum), defaults to `TOptionTab.INPUTS`.

## Return Value

This method does not return a value.

## Description

The `RegOption` method registers a new option parameter for an indicator or strategy. This is used to define the configurable parameters that users can adjust when applying the indicator or strategy.

See [TOptionType](/fto-indicators-docs/types/option-type.md) for a complete list of option types.

## Example

```typescript


// Declare parameters as class fields
public Period!: TOptValue_number;
public Color!: TOptValue_number;
public Deviation!: TOptValue_number;
public ShowLabels!: TOptValue_bool;
public FillPriceType!: TOptValue_number;

Init(): void {
    // Create parameters
    this.Period = this.api.createTOptValue_number(8);
    this.Color = this.api.createTOptValue_number(0);
    this.Deviation = this.api.createTOptValue_number(0);
    this.ShowLabels = this.api.createTOptValue_bool(true);
    this.FillPriceType = this.api.createTOptValue_number(0);

    // Register a period option
    this.api.RegOption("Period", TOptionType.INTEGER, this.Period);

    // Register a color option
    this.api.RegOption("Deviation", TOptionType.DOUBLE, this.Deviation);

    // Register a boolean option
    this.api.RegOption("Show Labels", TOptionType.BOOLEAN, this.ShowLabels);

    // Register an enum option
    this.api.RegOption('Fill Price Type',TOptionType.ENUM_TYPE,this.FillPriceType)

    this.api.AddOptionValue('Fill Price Type','Close')
    this.api.AddOptionValue('Fill Price Type','HighLow')
}
```
