SetOptionDigits

Sets the number of decimal digits for a numeric option.

Syntax

SetOptionDigits(name: string, digits: number): void

Parameters

  • name - A string containing the name of the option to set the digits for.

  • digits - A number representing the number of decimal digits to display.

Return Value

This method does not return a value.

Description

The SetOptionDigits method sets the number of decimal digits for a numeric option. This is used to define how many decimal places should be displayed and used for a numeric option in an indicator or strategy.

Example

// Register a level option
this.api.RegOption("Overbought Level", TOptionType.DOUBLE, 70.0);

// Set to display 1 decimal digit
this.api.SetOptionDigits("Overbought Level", 1);

// Register a multiplier option
this.api.RegOption("Multiplier", TOptionType.DOUBLE, 2.618);

// Set to display 3 decimal digits
this.api.SetOptionDigits("Multiplier", 3);

Last updated