TradeOnReplayDOCSSearch the whole guidetradeonreplay.com

Guide / Scripts

Inputs and settings

Anything you declare with input.* appears in the indicator's gear, where you can change it without touching the code.

len  = input.int(14, "Length", minval = 1, maxval = 200, group = "Main")
src  = input.source(close, "Source")
mode = input.string("EMA", "Type", options = ["EMA", "SMA"])
tf   = input.timeframe("D", "Timeframe")
sess = input.session("0800-1600", "Session")

Kinds of input

FunctionSetting shown
input.int, input.floatA number. minval, maxval and step limit it.
input.boolA switch.
input.stringText, or a dropdown when you pass options.
input.colorA colour picker.
input.sourceA choice of price series (close, open, hl2, ...).
input.timeframeA timeframe dropdown.
input.sessionA session such as 0800-1600.
input.enumA dropdown of an enum's values, shown by their titles. See Enums.
input(...)The plain form picks the kind from the default you give.

Rules

  • An input's default must be a fixed value, not something computed from price.
  • Saved values are kept per input name, so renaming an input resets it.
  • group and title may be a string kept in a variable (G = "Main"), so a group name can be written once.