pine-script 中的 [] 是什么?
下面代码中 _smoothed[1] 变量的值是多少?
f_zrsi( _source, _length ) => rsi( _source, _length ) - 50
f_rsi( _source, _length, _mode ) =>
// get base rsi
float _zrsi = f_zrsi( _source, _length )
// smoothing in a manner similar to HA open, but rather using the realtime
// rsi in place of the prior close value.
var float _smoothed = na
_smoothed := na( _smoothed[1] ) ? _zrsi : ( _smoothed[1] + _zrsi ) / 2
// return the requested mode
_mode ? _smoothed : _zrsi
what is value of _smoothed[1] variable in below code?
f_zrsi( _source, _length ) => rsi( _source, _length ) - 50
f_rsi( _source, _length, _mode ) =>
// get base rsi
float _zrsi = f_zrsi( _source, _length )
// smoothing in a manner similar to HA open, but rather using the realtime
// rsi in place of the prior close value.
var float _smoothed = na
_smoothed := na( _smoothed[1] ) ? _zrsi : ( _smoothed[1] + _zrsi ) / 2
// return the requested mode
_mode ? _smoothed : _zrsi
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它被称为历史参考运算符用于访问历史数据。
在您的示例中,
_smoothed[1]
返回_smoothed
的先前值。It is called the History Reference Operator and is used to access historical data.
In your example,
_smoothed[1]
returns the previous value of_smoothed
.