iff

iff

もし…なら…他に…
iff(condition, then, _else) → bool
iff(condition, then, _else) → integer
iff(condition, then, _else) → float
iff(condition, then, _else) → color
iff(condition, then, _else) → series[float]
iff(condition, then, _else) → series[integer]
iff(condition, then, _else) → series[color]
iff(condition, then, _else) → string
iff(condition, then, _else) → input bool
iff(condition, then, _else) → input integer
iff(condition, then, _else) → input float
iff(condition, then, _else) → input string
iff(condition, then, _else) → input color
iff(condition, then, _else) → const bool
iff(condition, then, _else) → const integer
iff(condition, then, _else) → const float
iff(condition, then, _else) → const string
iff(condition, then, _else) → const color
iff(condition, then, _else) → series[bool]
iff(condition, then, _else) → series[string]
iff(condition, then, _else) → series[line]
iff(condition, then, _else) → series[label]

// Draw circles at the bars where open crosses close
s1 = iff(cross(open, close), avg(open,close), na)
plot(s1, style=plot.style_circles, linewidth=4, color=color.green)

戻り
yまたはz形式。

引数
condition (series) 条件値を持つ形式。 ゼロ値(0やNaN、+ Infinity、-Infinity)はfalseとみなされ、他の値はtrueです。
then (series) 条件がtrueの場合に返される値の形式。
_else (series) conditionがfalseの場合に返される値を持つ系列。 ‘else’分岐が必要ない場合は、 `_else`引数にnaを使用してください。

備考
iffは三項条件演算子{@op?:}と全く同じことをしますが、機能形式では同じです。 また、iffは演算子{@op?:}よりやや効率が劣ります。

\ 最新情報をチェック /

コメントを残す

Pineスクリプト

前の記事

hour
Pineスクリプト

次の記事

input