Lipi Reference
Lipi

Functions

input.timeframe()

Asks the reader for a timeframe. The answer arrives as a string. Note what it is not: choosing a timeframe here does not fetch that timeframe's data. Lipi has no way to request another symbol's or another interval's series.

Syntax

                input.timeframe(const string defval, const string title, const string tooltip, const string inline, const string group, const bool confirm) → input string
              

Arguments

defval required const string Determines the default value of the input variable proposed in the script's "Settings/Inputs" tab, from where the user can change it. When a list of values is used with the options parameter, the value must be one of them.
title const string Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.
tooltip const string The string that will be shown to the user when hovering over the tooltip icon.
inline const string Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line.
group const string Creates a header above all inputs using the same group argument string. The string is also used as the header's text.
confirm const bool If true, then user will be asked to confirm input value before indicator is added to chart. Default value is false.

Return Type

input string

Example


          //@lipi=2
indicator("input.timeframe Example", overlay=true)
tf = input.timeframe("1D", "Reference Timeframe")
// The input returns text only: compare it with the chart's own interval
sameAsChart = tf == interval.interval
bgcolor(sameAsChart ? color.new(color.green, 0.1) : na)