Skip to content
Algo Trade Analytics Docs

input.session() - Pine Script Function

Adds an input to the Inputs tab of your script’s Settings, which allows you to provide configuration options to script users. This function adds two dropdowns that allow the user to specify the beginning and the end of a session using the session selector and returns the result as a string.

input.session(defval, title, options, tooltip, inline, group, confirm, display, active) → input string
NameTypeDescription
defvalconst stringDetermines the default value of the input variable proposed in the script’s “Settings/Inputs” tab
fromwhere the user can change it. When a list of values is used with the options parameter
thevalue must be one of them.

Value of input variable.

  • Result of input.session function always should be assigned to a variable, see examples above.
//@version=6
indicator("input.session", overlay=true)
i_sess = input.session("1300-1700", "Session", options=["0930-1600", "1300-1700", "1700-2100"])t = time(timeframe.period, i_sess)
bgcolor(time == t ? color.green : na)