Inputs

Per-strategy parameters that surface in the analyzer UI for tuning and sweeping.

input.int

input.int(default, label, min?, max?, step?, tooltip?)

Integer parameter with optional range constraints.

Creates an integer input that appears in the settings panel when the user configures your indicator or strategy. The value is accessible as a class attribute via self.<field_name>.

Parameters

  • default (int, default required): Default value
  • label (str, default required): Display label in settings panel
  • min (int, default None): Minimum allowed value
  • max (int, default None): Maximum allowed value
  • step (int, default 1): Increment step for the slider
  • tooltip (str, default None): Hover tooltip text

Returns

int

Example

period = input.int(14, "RSI Period", min=2, max=100)
length = input.int(20, "Length", min=1, max=500, step=5)

input.float

input.float(default, label, min?, max?, step?, tooltip?)

Decimal parameter for multipliers, thresholds, and ratios.

Parameters

  • default (float, default required): Default value
  • label (str, default required): Display label in settings panel
  • min (float, default None): Minimum allowed value
  • max (float, default None): Maximum allowed value
  • step (float, default 0.1): Increment step
  • tooltip (str, default None): Hover tooltip text

Returns

float

Example

multiplier = input.float(2.0, "Std Dev", min=0.5, max=5.0, step=0.1)

input.color

input.color(default, label, tooltip?)

Color picker for line and fill colors.

Creates a color picker input. The value is a hex color string (e.g. "#2962FF") passed to plot(), hline(), and fill().

Parameters

  • default (str, default required): Default hex color string
  • label (str, default required): Display label in settings panel
  • tooltip (str, default None): Hover tooltip text

Returns

str (hex color)

Example

color = input.color("#2962FF", "Line Color")

input.bool

input.bool(default, label, tooltip?)

Toggle checkbox for enabling/disabling features.

Parameters

  • default (bool, default required): Default value
  • label (str, default required): Display label in settings panel
  • tooltip (str, default None): Hover tooltip text

Returns

bool

Example

show_fill = input.bool(True, "Show Fill")

input.string

input.string(default, label, options?, tooltip?)

Text input or dropdown selector.

When options is provided, renders as a dropdown. Without options, renders as a free-text input field.

Parameters

  • default (str, default required): Default value
  • label (str, default required): Display label in settings panel
  • options (list[str], default None): Allowed values, renders as dropdown
  • tooltip (str, default None): Hover tooltip text

Returns

str

Example

ma_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA"])

input.source

input.source(default, label, tooltip?)

Price source selector dropdown.

Creates a dropdown to select a price source. The value resolves to the corresponding pandas Series at runtime.

Parameters

  • default (Source, default required): Default Source enum value
  • label (str, default required): Display label in settings panel
  • tooltip (str, default None): Hover tooltip text

Returns

pandas Series (the selected price source)

Example

from quant_charts import Source
src = input.source(Source.CLOSE, "Price Source")

Notes

  • Sources: Source.CLOSE, .OPEN, .HIGH, .LOW, .HL2, .HLC3, .OHLC4