# 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')
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://fto-2.gitbook.io/fto-indicators-docs/external_parameters_definition/reg-option.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
