Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/348.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 为什么我总是得到';未声明的标识符';pine脚本上的错误消息?_Python_Pine Script - Fatal编程技术网

Python 为什么我总是得到';未声明的标识符';pine脚本上的错误消息?

Python 为什么我总是得到';未声明的标识符';pine脚本上的错误消息?,python,pine-script,Python,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 : Undecla

我一直在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)

在函数内声明的变量只能在该函数内使用。注意正确的空格数也很重要

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)

你解决了问题,下次我会小心的。祝你好运。