提问人:Cletis Klampett 提问时间:9/24/2023 最后编辑:ProgmanCletis Klampett 更新时间:9/24/2023 访问量:30
无法使用参数“length”=“smoothD”调用“ta.sma”。使用了“input float”类型的参数,但应使用“series int”
Cannot call 'ta.sma' with argument 'length'='smoothD'. An argument of 'input float' type was used but a 'series int' is expected
问:
这里是全新的。有人可以帮助破译以下错误吗?我正在尝试在图表上绘制以下信息:
无法使用参数“length”=“smoothD”调用“ta.sma”。使用了“input float”类型的参数,但应使用“series int”。
//@version=5
strategy("FingersCrossed Signals", overlay=true)
//ta.ema
ema3 = ta.ema(close,9)
ema4 = ta.ema(close,21)
long_ema = ta.crossover(ema3,ema4)
short_ema = ta.crossover(ema4,ema3)
//stochrsi
smoothK = input.float(3, minval=1)
smoothD = input.float(3, minval=1)
lengthRSI = input.float(14, minval=1)
lengthStoch = input.float(14, minval=1)
src = input(close, title="RSI Source")
rsi1 = ta.rsi(src, lengthRSI)
k = ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
d = ta.sma(k, smoothD)
data = (60-k[1])/2
data2 = (k[1]-40)/2
long_stoch = k[1] >= d[1] and k[2] <= d[2] and k <= 60 and k >= 10
short_stoch = k[1] <= d[1] and k[2] >= d[2] and k >= 40 and k <= 95
//entries
if (long_ema)
strategy.entry("buy", strategy.long)
if (ema3 > ema4 and long_stoch) // ema3 > ema4 means that crossover was already and uptrend is continuing
strategy.entry("buy+1", strategy.long)
if (short_ema)
strategy.entry("sell", strategy.short)
答:
0赞
vitruvius
9/24/2023
#1
错误消息很清楚,不是吗?您需要使用 an 但您正在传递 .int
float
和 之间是有区别的。您可以阅读本文以了解 pinescript 中的数据类型。int
float
您的输入没有任何意义,因为它们是 s。把它们改成,你会很好。float
float
length
int
评论
0赞
Cletis Klampett
9/24/2023
太好了,谢谢!
评论