int

Adds an integer number field to your indicator’s Inputs panel. Perfect for whole-number settings like β€œPeriod”, β€œLength”, or β€œBars to look back”. You can define minimum, maximum, and step values to restrict user input.

Syntax

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

Parameters

  • title string β€” Label shown in the Inputs panel.

  • value number β€” Default integer value.

  • id string (optional) β€” Unique key for referencing this input. Auto-generated from title if omitted (lowercased, spaces removed).

  • min number (optional) β€” Minimum allowed value.

  • max number (optional) β€” Maximum allowed value.

  • step number (optional) β€” Increment between values (e.g., 5 β†’ values like 5, 10, 15).

  • tooltip string (optional) β€” Hover text for UI guidance.

  • group string (optional) β€” Groups related inputs into collapsible sections.

  • inline string (optional) β€” Aligns multiple inputs in the same row if they share the same inline key.

Return Value

{ id: string } β€” The assigned id, either custom or auto-generated.

Example

Result

circle-info

Tips

  • Use min and max to prevent invalid values (e.g., period length must be >0).

  • Adding a step makes the spinner more user-friendly (e.g., jump in multiples of 5).

triangle-exclamation

Warning

circle-check

Good Practice

Last updated