input

input.bool #

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 a checkmark to the script’s inputs.

input.bool(defval, title, tooltip, inline, group, confirm)  input bool
戻り値 #

input変数の値。

引数 #
defval (const bool)Determines the default value of the input variable proposed in the script’s “Settings/Inputs” tab, from where the user can change it.
title (const string)入力項目のタイトルです。指定されていない場合には、変数名が入力のタイトルとして使用されます。タイトルが指定されている場合でもそれが空の場合には、名前は空の文字列になります。
tooltip (const string)ツールチップアイコンにカーソルを合わせた時にユーザーに表示される文字列です。
inline (const string)同じ引数を使ったすべてのinputの呼び出しを1行にまとめます。引数として使われる文字列は表示されません。これは、同じ行に属する入力項目を識別するためにのみ使用されます。
group (const string)同じグループ引数の文字列を使用するすべての入力項目の上にヘッダーを作成します。この文字列は、ヘッダーのテキストとしても使用されます。
confirm (const bool)If true, then user will be asked to confirm input value before indicator is added to chart. Default value is false.
#
i_switch = input.bool(true, "On/Off")
plot(i_switch ? open : na)
備考 #

Result of input.bool function always should be assigned to a variable, see examples above.

関連 #

input.int, input.float, input.string, input.symbol, input.timeframe, input.session, input.source, input.color, input.time, input

input.color #

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 a color picker that allows the user to select a color and transparency, either from a palette or a hex value.

input.color(defval, title, tooltip, inline, group, confirm)  input color
戻り値 #

input変数の値。

引数 #
defval (const color)Determines the default value of the input variable proposed in the script’s “Settings/Inputs” tab, from where the user can change it.
title (const string)入力項目のタイトルです。指定されていない場合には、変数名が入力のタイトルとして使用されます。タイトルが指定されている場合でもそれが空の場合には、名前は空の文字列になります。
tooltip (const string)ツールチップアイコンにカーソルを合わせた時にユーザーに表示される文字列です。
inline (const string)同じ引数を使ったすべてのinputの呼び出しを1行にまとめます。引数として使われる文字列は表示されません。これは、同じ行に属する入力項目を識別するためにのみ使用されます。
group (const string)同じグループ引数の文字列を使用するすべての入力項目の上にヘッダーを作成します。この文字列は、ヘッダーのテキストとしても使用されます。
confirm (const bool)If true, then user will be asked to confirm input value before indicator is added to chart. Default value is false.
#
i_col = input.color(color.red, "Plot Color")
plot(close, color=i_col)
備考 #

Result of input.color function always should be assigned to a variable, see examples above.

関連 #

input.bool, input.int, input.float, input.string, input.symbol, input.timeframe, input.session, input.source, input.time, input

input.float #

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 a field for a float input to the script’s inputs.

input.float(defval, title, minval, maxval, step, tooltip, inline, group, confirm)  input float
input.float(defval, title, options, tooltip, inline, group, confirm)  input float
戻り値 #

input変数の値。

引数 #
defval (const int/float)Determines the default value of the input variable proposed in the script’s “Settings/Inputs” tab, from where script users can change it. When a list of values is used with the options parameter, the value must be one of them.
title (const string)入力項目のタイトルです。指定されていない場合には、変数名が入力のタイトルとして使用されます。タイトルが指定されている場合でもそれが空の場合には、名前は空の文字列になります。
minval (const int/float)Minimal possible value of the input variable. Optional.
maxval (const int/float)Maximum possible value of the input variable. Optional.
step (const int/float)Step value used for incrementing/decrementing the input. Optional. The default is 1.
options (tuple of const int/float values: [val1, val2, …])A list of options to choose from a dropdown menu, separated by commas and enclosed in square brackets: [val1, val2, …]. When using this parameter, the minval, maxval and step parameters cannot be used.
tooltip (const string)ツールチップアイコンにカーソルを合わせた時にユーザーに表示される文字列です。
inline (const string)同じ引数を使ったすべてのinputの呼び出しを1行にまとめます。引数として使われる文字列は表示されません。これは、同じ行に属する入力項目を識別するためにのみ使用されます。
group (const string)同じグループ引数の文字列を使用するすべての入力項目の上にヘッダーを作成します。この文字列は、ヘッダーのテキストとしても使用されます。
confirm (const bool)If true, then user will be asked to confirm input value before indicator is added to chart. Default value is false.
#
i_angle1 = input.float(0.5, "Sin Angle", minval=-3.14, maxval=3.14, step=0.02)
plot(math.sin(i_angle1) > 0 ? close : open, "sin", color=color.green)

i_angle2 = input.float(0, "Cos Angle", options=[-3.14, -1.57, 0, 1.57, 3.14])
plot(math.cos(i_angle2) > 0 ? close : open, "cos", color=color.red)
備考 #

Result of input.float function always should be assigned to a variable, see examples above.

関連 #

input.bool, input.int, input.string, input.symbol, input.timeframe, input.session, input.source, input.color, input.time, input

input.int #

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 a field for an integer input to the script’s inputs.

input.int(defval, title, minval, maxval, step, tooltip, inline, group, confirm)  input int
input.int(defval, title, options, tooltip, inline, group, confirm)  input int
戻り値 #

input変数の値。

引数 #
defval (const int)Determines the default value of the input variable proposed in the script’s “Settings/Inputs” tab, from where script users can change it. When a list of values is used with the options parameter, the value must be one of them.
title (const string)入力項目のタイトルです。指定されていない場合には、変数名が入力のタイトルとして使用されます。タイトルが指定されている場合でもそれが空の場合には、名前は空の文字列になります。
minval (const int)Minimal possible value of the input variable. Optional.
maxval (const int)Maximum possible value of the input variable. Optional.
step (const int)Step value used for incrementing/decrementing the input. Optional. The default is 1.
options (tuple of const int values: [val1, val2, …])A list of options to choose from a dropdown menu, separated by commas and enclosed in square brackets: [val1, val2, …]. When using this parameter, the minval, maxval and step parameters cannot be used.
tooltip (const string)ツールチップアイコンにカーソルを合わせた時にユーザーに表示される文字列です。
inline (const string)同じ引数を使ったすべてのinputの呼び出しを1行にまとめます。引数として使われる文字列は表示されません。これは、同じ行に属する入力項目を識別するためにのみ使用されます。
group (const string)同じグループ引数の文字列を使用するすべての入力項目の上にヘッダーを作成します。この文字列は、ヘッダーのテキストとしても使用されます。
confirm (const bool)If true, then user will be asked to confirm input value before indicator is added to chart. Default value is false.
#
i_len1 = input.int(10, "Length 1", minval=5, maxval=21, step=1)
plot(ta.sma(close, i_len1))

i_len2 = input.int(10, "Length 2", options=[5, 10, 21])
plot(ta.sma(close, i_len2))
備考 #

Result of input.int function always should be assigned to a variable, see examples above.

関連 #

input.bool, input.float, input.string, input.symbol, input.timeframe, input.session, input.source, input.color, input.time, input

input.price #

Adds a price input to the script’s “Settings/Inputs” tab. Using confirm = true activates the interactive input mode where a price is selected by clicking on the chart.

input.price(defval, title, tooltip, inline, group, confirm)  input float
戻り値 #

input変数の値。

引数 #
defval (const int/float)Determines the default value of the input variable proposed in the script’s “Settings/Inputs” tab, from where the user can change it.
title (const string)入力項目のタイトルです。指定されていない場合には、変数名が入力のタイトルとして使用されます。タイトルが指定されている場合でもそれが空の場合には、名前は空の文字列になります。
tooltip (const string)ツールチップアイコンにカーソルを合わせた時にユーザーに表示される文字列です。
inline (const string)同じ引数を使ったすべてのinputの呼び出しを1行にまとめます。引数として使われる文字列は表示されません。これは、同じ行に属する入力項目を識別するためにのみ使用されます。
group (const string)同じグループ引数の文字列を使用するすべての入力項目の上にヘッダーを作成します。この文字列は、ヘッダーのテキストとしても使用されます。
confirm (const bool)If true, the interactive input mode is enabled and the selection is done by clicking on the chart when the indicator is added to the chart, or by selecting the indicator and moving the selection after that. Optional. The default is false.
#
price1 = input.price(title="Date", defval=42)
plot(price1)

price2 = input.price(54, title="Date")
plot(price2)
備考 #

When using interactive mode, a time input can be combined with a price input if both function calls use the same argument for their inline parameter.

関連 #

input.bool, input.int, input.float, input.string, input.symbol, , input.session, input.source, input.color, input

input.session #

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)  input string
戻り値 #

input変数の値。

引数 #
defval (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)入力項目のタイトルです。指定されていない場合には、変数名が入力のタイトルとして使用されます。タイトルが指定されている場合でもそれが空の場合には、名前は空の文字列になります。
options (tuple of const string values: [val1, val2, …])A list of options to choose from.
tooltip (const string)ツールチップアイコンにカーソルを合わせた時にユーザーに表示される文字列です。
inline (const string)同じ引数を使ったすべてのinputの呼び出しを1行にまとめます。引数として使われる文字列は表示されません。これは、同じ行に属する入力項目を識別するためにのみ使用されます。
group (const string)同じグループ引数の文字列を使用するすべての入力項目の上にヘッダーを作成します。この文字列は、ヘッダーのテキストとしても使用されます。
confirm (const bool)If true, then user will be asked to confirm input value before indicator is added to chart. Default value is false.
#
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)
備考 #

Result of input.session function always should be assigned to a variable, see examples above.

関連 #

input.bool, input.int, input.float, input.string, input.symbol, input.timeframe, input.source, input.color, input.time, input

input.source #

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 a dropdown that allows the user to select a source for the calculation, e.g. close, hl2, etc. If the script includes only one input.source() call, the user can also select an output from another indicator on their chart as the source.

input.source(defval, title, tooltip, inline, group)  series float
戻り値 #

input変数の値。

引数 #
defval (series int/float)Determines the default value of the input variable proposed in the script’s “Settings/Inputs” tab, from where the user can change it.
title (const string)入力項目のタイトルです。指定されていない場合には、変数名が入力のタイトルとして使用されます。タイトルが指定されている場合でもそれが空の場合には、名前は空の文字列になります。
tooltip (const string)ツールチップアイコンにカーソルを合わせた時にユーザーに表示される文字列です。
inline (const string)同じ引数を使ったすべてのinputの呼び出しを1行にまとめます。引数として使われる文字列は表示されません。これは、同じ行に属する入力項目を識別するためにのみ使用されます。
group (const string)同じグループ引数の文字列を使用するすべての入力項目の上にヘッダーを作成します。この文字列は、ヘッダーのテキストとしても使用されます。
#
i_src = input.source(close, "Source")
plot(i_src)
備考 #

Result of input.source function always should be assigned to a variable, see examples above.

関連 #

input.bool, input.int, input.float, input.string, input.symbol, input.timeframe, input.session, input.color, input.time, input

input.string #

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 a field for a string input to the script’s inputs.

input.string(defval, title, options, tooltip, inline, group, confirm)  input string
戻り値 #

input変数の値。

引数 #
defval (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)入力項目のタイトルです。指定されていない場合には、変数名が入力のタイトルとして使用されます。タイトルが指定されている場合でもそれが空の場合には、名前は空の文字列になります。
options (List of constants: […])A list of options to choose from.
tooltip (const string)ツールチップアイコンにカーソルを合わせた時にユーザーに表示される文字列です。
inline (const string)同じ引数を使ったすべてのinputの呼び出しを1行にまとめます。引数として使われる文字列は表示されません。これは、同じ行に属する入力項目を識別するためにのみ使用されます。
group (const string)同じグループ引数の文字列を使用するすべての入力項目の上にヘッダーを作成します。この文字列は、ヘッダーのテキストとしても使用されます。
confirm (const bool)If true, then user will be asked to confirm input value before indicator is added to chart. Default value is false.
#
i_text = input.string("Hello!", "Message")
l = label.new(bar_index, high, i_text)
label.delete(l[1])
備考 #

Result of input.string function always should be assigned to a variable, see examples above.

関連 #

input.bool, input.int, input.float, input.symbol, input.timeframe, input.session, input.source, input.color, input.time, input

input.symbol #

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 a field that allows the user to select a specific symbol using the symbol search and returns that symbol, paired with its exchange prefix, as a string.

input.symbol(defval, title, tooltip, inline, group, confirm)  input string
戻り値 #

input変数の値。

引数 #
defval (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.
title (const string)入力項目のタイトルです。指定されていない場合には、変数名が入力のタイトルとして使用されます。タイトルが指定されている場合でもそれが空の場合には、名前は空の文字列になります。
tooltip (const string)ツールチップアイコンにカーソルを合わせた時にユーザーに表示される文字列です。
inline (const string)同じ引数を使ったすべてのinputの呼び出しを1行にまとめます。引数として使われる文字列は表示されません。これは、同じ行に属する入力項目を識別するためにのみ使用されます。
group (const string)同じグループ引数の文字列を使用するすべての入力項目の上にヘッダーを作成します。この文字列は、ヘッダーのテキストとしても使用されます。
confirm (const bool)If true, then user will be asked to confirm input value before indicator is added to chart. Default value is false.
#
i_sym = input.symbol("DELL", "Symbol")
s = request.security(i_sym, 'D', close)
plot(s)
備考 #

Result of input.symbol function always should be assigned to a variable, see examples above.

関連 #

input.bool, input.int, input.float, input.string, input.timeframe, input.session, input.source, input.color, input.time, input

input.time #

Adds a time input to the script’s “Settings/Inputs” tab. This function adds two input widgets on the same line: one for the date and one for the time. The function returns a date/time value in UNIX format. Using confirm = true activates the interactive input mode where a point in time is selected by clicking on the chart.

input.time(defval, title, tooltip, inline, group, confirm)  input int
戻り値 #

input変数の値。

引数 #
defval (const int)Determines the default value of the input variable proposed in the script’s “Settings/Inputs” tab, from where the user can change it. The value can be a timestamp function, but only if it uses a date argument in const string format.
title (const string)入力項目のタイトルです。指定されていない場合には、変数名が入力のタイトルとして使用されます。タイトルが指定されている場合でもそれが空の場合には、名前は空の文字列になります。
tooltip (const string)ツールチップアイコンにカーソルを合わせた時にユーザーに表示される文字列です。
inline (const string)同じ引数を使ったすべてのinputの呼び出しを1行にまとめます。引数として使われる文字列は表示されません。これは、同じ行に属する入力項目を識別するためにのみ使用されます。
group (const string)同じグループ引数の文字列を使用するすべての入力項目の上にヘッダーを作成します。この文字列は、ヘッダーのテキストとしても使用されます。
confirm (const bool)If true, the interactive input mode is enabled and the selection is done by clicking on the chart when the indicator is added to the chart, or by selecting the indicator and moving the selection after that. Optional. The default is false.
#
i_date = input.time(timestamp("20 Jul 2021 00:00 +0300"), "Date")
l = label.new(i_date, high, "Date", xloc=xloc.bar_time)
label.delete(l[1])
備考 #

When using interactive mode, a price input can be combined with a time input if both function calls use the same argument for their inline parameter.

関連 #

input.bool, input.int, input.float, input.string, input.symbol, input.timeframe, input.session, input.source, input.color, input

input.timeframe #

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 a dropdown that allows the user to select a specific timeframe via the timeframe selector and returns it as a string. The selector includes the custom timeframes a user may have added using the chart’s Timeframe dropdown.

input.timeframe(defval, title, options, tooltip, inline, group, confirm)  input string
戻り値 #

input変数の値。

引数 #
defval (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)入力項目のタイトルです。指定されていない場合には、変数名が入力のタイトルとして使用されます。タイトルが指定されている場合でもそれが空の場合には、名前は空の文字列になります。
options (tuple of const string values: [val1, val2, …])A list of options to choose from.
tooltip (const string)ツールチップアイコンにカーソルを合わせた時にユーザーに表示される文字列です。
inline (const string)同じ引数を使ったすべてのinputの呼び出しを1行にまとめます。引数として使われる文字列は表示されません。これは、同じ行に属する入力項目を識別するためにのみ使用されます。
group (const string)同じグループ引数の文字列を使用するすべての入力項目の上にヘッダーを作成します。この文字列は、ヘッダーのテキストとしても使用されます。
confirm (const bool)If true, then user will be asked to confirm input value before indicator is added to chart. Default value is false.
#
i_res = input.timeframe('D', "Resolution", options=['D', 'W', 'M'])
s = request.security("AAPL", i_res, close)
plot(s)
備考 #

Result of input.timeframe function always should be assigned to a variable, see examples above.

関連 #

input.bool, input.int, input.float, input.string, input.symbol, input.session, input.source, input.color, input.time, input

© - 2021 - TradingViewの教科書