我该如何修复 "cannot call rma with arguments" 错误?

How do i fix "cannot call rma with arguments" error?

我正在尝试使用 accumulation/distribution 下面的代码作为我的 pinescript 策略中的指标之一,但我在尝试输入多头和空头条件时收到错误消息。这是下面的代码:

1. Ind_Conf_2_Check = input(true, title = "Indicator 2 - C2)

2. len = input(14, minval = 1, title="A/D Length")          // EMA27 = SMMA/RMA14 - lunar month
3. price_enable = input(true, title="factor price (=money flow)")
4. AD_weight = input(0.0, minval=0.0, maxval=1.0, step=0.5, title="A/D weight (at 1 all volume is included)"

5. AD_ratio = nz(change(close) / tr(true))         // 'True Range' fixes issues caused by gaps in price
6. AD_ratio := (1 - AD_weight) * AD_ratio + sign (AD_ratio) * AD_weight

7. trl = min(low, close[1])
8. trh = max(high, close[1])
9. vol = if price_enable
10.     volume * hlc3
11.  else
12.     volume 
13.
14. plot(rma(vol * AD_ratio, len), style=plot.style_line, color=#4477ffff, title="A/D Money Flow")
15. hline(0, color=color.black, linestyle=hline.style_dotted, title="Zero line")

16. Ind_Conf_2_l = Ind_Conf_2_Check ? rma(vol * AD_ratio) > 0 ? true : false : false
17. Ind_Conf_2_s = Ind_Conf_2_Check ? rma(vol * AD_ratio) < 0 ? true : false : false

下面是错误消息:

LINE 16: Cannot call 'rma' with arguments (series[float]); available overloads: rma(series[float], integer) => series[float];

LINE 17: Cannot call 'rma' with arguments (series[float]); available overloads: RMA(series[float], integer) => series[float];

谢谢大家

您忘记为 rma() 函数调用提供 len 参数。

//@version=4
study("TEST", shorttitle="TST", overlay=true)

Ind_Conf_2_Check    = input(true, title = "Indicator 2 - C2")
len                 = input(14, minval = 1, title="A/D Length")          // EMA27 = SMMA/RMA14 - lunar month
price_enable        = input(true, title="factor price (=money flow)")
AD_weight           = input(0.0, minval=0.0, maxval=1.0, step=0.5, title="A/D weight (at 1 all volume is included)")

AD_ratio = nz(change(close) / tr(true))         // 'True Range' fixes issues caused by gaps in price
AD_ratio := (1 - AD_weight) * AD_ratio + sign (AD_ratio) * AD_weight

trl = min(low, close[1])
trh = max(high, close[1])
vol = if price_enable
    volume * hlc3
else
    volume 

plot(rma(vol * AD_ratio, len), style=plot.style_line, color=#4477ffff, title="A/D Money Flow")
hline(0, color=color.black, linestyle=hline.style_dotted, title="Zero line")

Ind_Conf_2_l = Ind_Conf_2_Check ? rma(vol * AD_ratio, len) > 0 ? true : false : false
Ind_Conf_2_s = Ind_Conf_2_Check ? rma(vol * AD_ratio, len) < 0 ? true : false : false