float

Adds a floating-point number field to your indicator’s Inputs panel. Useful for decimal values like thresholds, multipliers, percentages, or coefficients. Like int(), you can define minimum, maximum, and step values to constrain what the user can enter.

Syntax

input.float(title, value, id?, min?, max?, step?, tooltip?, group?, inline?)

Parameters

  • title string — Label shown in the Inputs panel.

  • value number — Default decimal value.

  • id string (optional) — Unique key for referencing this input. Auto-generated from title if omitted (lowercased, no spaces).

  • min number (optional) — Minimum allowed value.

  • max number (optional) — Maximum allowed value.

  • step number (optional) — Increment between values (e.g., 0.1 → values like 0.1, 0.2, 0.3).

  • tooltip string (optional) — Hover text that explains the parameter.

  • group string (optional) — Organizes this input under a collapsible section.

  • inline string (optional) — Aligns multiple inputs in one row if they share the same inline key.

Return Value

{ id: string } — The assigned id, either provided or auto-generated.

Example

Result

Tips

  • Use step values like 0.1 or 0.01 to make fine-tuning easy for users.

  • Keep default values practical (e.g., 1.5 for ATR multipliers is a common starting point).

Warning

Good Practice

Last updated