Skip to main content
ATK Pine Script®

input.* Parameter Reference

Complete reference for all input.* functions in ATK PyneScript V6 — choosing the right input family, parameters, and merging patterns.

input.* Namespace#

Every input registration appends metadata into the script context and returns the default value immediately, so your module can use it as a plain Python value.

MethodReturn typeTypical argsUse case
input.int(defval=0, title="", key=None, **kwargs)intminval, maxval, stepLengths, lookbacks, counts.
input.float(defval=0.0, ...)floatminval, maxval, stepMultipliers, thresholds, sizing.
input.bool(defval=False, ...)boolBoolean togglesFeature flags and display controls.
input.string(defval="", ...)strPlain textModes, source keys, labels.
input.text_area(defval="", ...)strLong-form textNotes or text payload input.
input.time(defval=0, ...)intTimestamp defaultTime anchors.
input.price(defval=0.0, ...)floatPrice level defaultFixed price references.
input.source(defval="close", ...)strSource field nameSelect market source column.
input.symbol(defval="", ...)strSymbol selectorExternal symbol input.
input.session(defval="", ...)strSession stringSession filtering.
input.timeframe(defval="", ...)strTimeframe string like 15mMTF confirmation.
input.color(defval="#00c853", ...)strHex or color stringVisual style input.
input.enum(defval=None, title="", key=None, options=None, **kwargs)AnyoptionsBounded choice selection.

How defval worksdefval is the value returned immediately at import time and the value used when the runtime has not supplied an override. Treat it as the script's safe startup configuration.

Why key matterskey is the stable identity for the setting in the runtime. Keep it short, explicit, and durable. Changing keys later breaks continuity between saved settings and the script contract.

How to merge params — Use inputs as typed defaults, then merge params over them inside the frame builder. That keeps the script runnable as plain Python while still respecting runtime overrides.

Choosing the Right Input Family#

Input familyChoose it when...Practical guidance
input.intThe value is a discrete count, lookback, or bar distance.Use for lengths and counts. Add minval=1 when zero or negative values would make the indicator invalid.
input.floatThe value is continuous: multipliers, thresholds, percent-like knobs.Use step to control UI granularity. A BBands multiplier is a float because 1.5 and 2.25 are meaningful values.
input.boolThe setting toggles a feature on or off.Good for showing markers, enabling a filter, or switching between base and advanced output layers.
input.stringThe user chooses a small freeform mode label or source name.Use it when values are text but not naturally bounded by a strict enum. For highly constrained choices, prefer input.enum.
input.sourceThe user should select a column-like market source.Use for open, high, low, close, or derived source names. Always implement a fallback when the chosen source is absent.
input.timeframeThe user selects an alternate timeframe for confirmation or aggregation.Use only when the script actually calls request.security or similar logic. Do not add a timeframe input as decoration.
input.priceThe setting is a fixed chart level.Use for thresholds, zones, and manual anchors where the number represents a price, not a generic multiplier.
input.timeThe user must choose a specific timestamp.Useful for fixed-range studies, manual windows, and time-anchored objects.
input.colorThe user controls styling without changing logic.Keep color inputs cosmetic. Do not overload them with semantic decisions that should be real boolean or enum settings.
input.enumThe choice must be limited to known valid values.Best for modes like sma versus ema, panel position choices, or named logic variants where arbitrary text would be error-prone.

Code Example: Choosing the Right Input Family#

from source import input


# Discrete bar count.
length = input.int(20, title="Length", key="length", minval=1)

# Continuous multiplier.
multiplier = input.float(2.0, title="StdDev Mult", key="multiplier", minval=0.1, step=0.1)

# Free text for lightweight labels.
label_text = input.string("baseline", title="Label", key="label_text")

# Multi-line notes.
notes = input.text_area("alpha\nbeta", title="Notes", key="notes")

# Interactive chart-pick pair.
trigger_time = input.time(1700000000, title="Trigger Time", key="trigger_time", confirm=True)
trigger_price = input.price(101.25, title="Trigger Price", key="trigger_price", confirm=True)

# Market source selector.
source_type = input.source("close", title="Source", key="source_type")

# Symbol and session selectors.
ticker = input.symbol("BINANCE:BTCUSDT", title="Ticker", key="ticker")
session_value = input.session("0930-1600", title="Session", key="session_value")

# Only add timeframe when you really call request.security later.
confirm_tf = input.timeframe("15m", title="Confirm TF", key="confirm_tf")

# Input-owned color value.
line_color = input.color("#2962ff", title="Line Color", key="line_color")

# Bounded named choice.
ma_mode = input.enum("ema", title="MA Mode", key="ma_mode", options=["sma", "ema", "rma"])

Rule of thumb: if free text would let the user enter invalid values, do not use input.string. Use input.enum or a more specific input family instead.

Interactive inputs: ATK now preserves confirm, time/price pairings, and picked-value metadata for input.time and input.price. Use those fields when the user should anchor a chart event explicitly rather than typing a generic number.

Input Merging Pattern#

length = input.int(20, title="Length", key="length", minval=1)
multiplier = input.float(2.0, title="StdDev Mult", key="multiplier", minval=0.1, step=0.1)
source_type = input.source("close", title="Source", key="source_type")


def build_indicator_frame(df, params=None):
    frame = df.copy().reset_index(drop=True)
    p = {
        "length": int(length),
        "multiplier": float(multiplier),
        "source_type": str(source_type),
    } | dict(params or {})

    source_name = str(p.get("source_type", "close") or "close")
    source_series = frame[source_name] if source_name in frame.columns else frame["close"]
    # use p["length"] and p["multiplier"] for computation

Download advanced input example