input
input
スクリプトインジケーターに入力を追加。
ユーザーはスクリプトスタディのオブジェクトダイアログのフォーマットに入力することで、表示や編集を行うことができます。
入力されたスクリプトはビルトインされたテクニカル分析インジケーターと同様にしっかりと表示され稼働します。
input(defval, title, type, confirm) → input bool
input(defval, title, type, minval, maxval, confirm, step, options) → input integer
input(defval, title, type, minval, maxval, confirm, step, options) → input float
input(defval, title, type, confirm, options) → input string
input(defval, title, type) → series[float]
例
b = input(title="On/Off", type=input.bool, defval=true)
plot(b ? open : na)
i = input(title="Offset", type=input.integer, defval=7, minval=-10, maxval=10)
plot(offset(close, i))
f = input(title="Angle", type=input.float, defval=-0.5, minval=-3.14, maxval=3.14, step=0.02)
plot(sin(f) > 0 ? close : open)
sym = input(title="Symbol", type=input.symbol, defval="DELL")
res = input(title="Resolution", type=input.resolution, defval="60")
plot(close, color=color.red)
plot(security(sym, res, close), color=color.green)
s = input(title="Session", defval="24x7", options=["24x7", "0900-1300", "1300-1700", "1700-2100"])
plot(time(timeframe.period, s))
src = input(title="Source", type=input.source, defval=close)
plot(src)
戻り
入力変数の値。
引数
defval (Depends on ‘type’ argument) 入力変数のデフォルト値。スクリプトによって実際に使用される入力値は、オブジェクトの書式設定ダイアログでユーザーが設定することに注意してください。
title (const string) 入力の表題
type (const string) Inputの種類。可能な値は input.bool, input.integer, input.float, input.string, input.symbol, input.resolution, input.session, input.sourceです。
minval (const integer, float) input変数の最小可能値。この引数はinputの種類がinput.integerかinput.floatの時にだけ用いられます。
maxval (const integer, float) input変数の最大可能値。この引数はinputの種類がinput.integerかinput.floatの時にだけ用いられます。
confirm (const bool) trueの場合、インジケーターをチャートに追加する前に、ユーザーはinput値の確認を求められます。デフォルト値はfalseです。この引数は、inputの種類がinput.sourceの時は利用されません。
step (const integer, float) フォーマットダイアログの入力を増減する際のステップ値。デフォルト値は1。この引数は、inputの種類がinput.integerとinput.floatの時にだけ用いられます。
options (List of constants: [<type>…]) 選択オプションのリスト。この引数は、inputの種類がの時input.integer, input.float, input.stringにだけ用いられます。
備考
input関数の結果は常に変数に代入する必要があります。以下の例を参照してください。