繁体   English   中英

为什么我在 pine 脚本上不断收到“未声明的标识符”错误消息?

[英]Why do I keep getting 'undeclared identifier' error message on pine script?

我一直在 pine 脚本上收到未声明标识符的错误消息,现在它变得令人沮丧。

line 19 : Undeclared identifier 'lag_s_k';
line 19 : Undeclared identifier 's1';
line 19 : Undeclared identifier  's3';
line 22 : Undeclared identifier 'vol';
line 24 : Undeclared identifier 'vol';
line 26 : Undeclared identifier 'vol_m'

这是完整的代码,谢谢大家。

dummydv = input(false, title="Damiani Volatmeter")
usevolmode = true 
//input(true, title = "use 
volume Mode")
vis_atr = input(13)
vis_std = input(20)
sed_atr = input(40)
sed_std = input(100)
threshold_level = input(1.4)
lag_supressor = input(true)
atrv(len)=>rma(volume,len)
//DV(13,20,40,100,1.4,true) 
  DV(vis_atr,vis_std,sed_atr,sed_std, threshold_level,lag_supressor)=>
 vol = 0.0
 lag_s_K = 0.5
 s1=nz(vol[1], 0)
 s3=nz(vol[3], 0)

vol = lag_supressor ? atr(vis_atr) / atr(sed_atr) + lag_s_K*(s1-s3) : atr(vis_atr) / atr(sed_atr)
anti_thres = stdev(close, vis_std) / stdev(close, sed_std)
t = threshold_level - anti_thres
vol_m = vol > t ? -1 : 0.03

plot (title="V",  series=vol, color=color.lime)
plot(title="A", series=t, color=color.silver)
plot(title="T", series=vol_m, color=color.maroon)

在 function 内声明的变量只能在 function 内使用。 观察正确的空格数也很重要。

dummydv = input(false, title="Damiani Volatmeter")
usevolmode = true 
//input(true, title = "use volume Mode")
vis_atr = input(13)
vis_std = input(20)
sed_atr = input(40)
sed_std = input(100)
threshold_level = input(1.4)
lag_supressor = input(true)
atrv(len)=>rma(volume,len)
//DV(13,20,40,100,1.4,true) 
//DV(vis_atr,vis_std,sed_atr,sed_std, threshold_level,lag_supressor)=>
vol = 0.0
lag_s_K = 0.5
s1=nz(vol[1], 0)
s3=nz(vol[3], 0)

vol := lag_supressor ? atr(vis_atr) / atr(sed_atr) + lag_s_K*(s1-s3) : atr(vis_atr) / atr(sed_atr)
anti_thres = stdev(close, vis_std) / stdev(close, sed_std)
t = threshold_level - anti_thres
vol_m = vol > t ? -1 : 0.03

plot (title="V",  series=vol, color=color.lime)
plot(title="A", series=t, color=color.silver)
plot(title="T", series=vol_m, color=color.maroon)

暂无
暂无

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

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