VARIABLE:junjd=0;
hdjj:=holding,linethick0;
buy(close>ref(hhv(h,3),1) and count(v,0)>10 and holding>=0 and holding<10,1,LIMITR,o);
junjd:=(junjd*hdjj+enterprice*(holding-hdjj))/if(holding=0,1,holding);
hju:junjd,linethick0;
直接用enterprice就可以了
你把中间的一些变量都输出看下,是哪个值没有取到你
在看,您稍等
因为你要取得enterprice的值,而没有开仓的话这个取值是无效值,所以导致了你后面全局变量取不到值
VARIABLE:junjd=0;
hdjj:=holding,linethick0;
if close>ref(hhv(h,3),1) and count(v,0)>10 and holding>=0 and holding<10 THEN
begin
buy(1,1,LIMITR,o);
junjd:=(junjd*hdjj+enterprice*(holding-hdjj))/if(holding=0,1,holding);
end
hju:junjd,linethick0;