简体   繁体   English

松脚本中的 [] 是什么?

[英]what is [] in pine-script?

what is value of _smoothed[1] variable in below code?以下代码中 _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

It is called the History Reference Operator and is used to access historical data.它被称为History Reference Operator ,用于访问历史数据。

In your example, _smoothed[1] returns the previous value of _smoothed .在您的示例中, _smoothed[1]返回_smoothed的先前值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM