以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://222.73.7.161/bbs/index.asp)
--  公式模型编写问题提交  (http://222.73.7.161/bbs/list.asp?boardid=4)
----  怎样能显示全局变量值的变化曲线  (http://222.73.7.161/bbs/dispbbs.asp?boardid=4&id=167623)

--  作者:m1978xz
--  发布时间:2019/1/10 14:43:21
--  怎样能显示全局变量值的变化曲线
代码如下,比如zs在一段时期肯定是有值的,如果一般变量去掉冒号后边的等号就能在图中显示这个值的变化曲线。
但是全局变量貌似没法这样。请问我应该怎么设置才能让全局变量在走势图中显示变化曲线?

runmode:0;
variable:zs=0,cc=0,hl=0;
ma5:=ma(c,5);
ma20:=ma(c,20);
entertime:=time>100000 and time<144500;
if holding>0 and cc<=0 then sell(1,1,limitr,o);
if holding<0 and cc>=0 then sellshort(1,1,limitr,o);
if holding=0 and cc>0 then buy(1,1,limitr,o);
if holding=0 and cc<0 then buyshort(1,1,limitr,o);
if cc>0 and l<zs then begin
sell(1,1,limitr,min(o,zs-0.6));
cc:=0;
end
if cc<0 and h>zs then begin
sellshort(1,1,limitr,max(o,zs+0.6));
cc:=0;
end
if cc>0 and ma5<ma20 then cc:=0;
if cc<0 and ma5>ma20 then cc:=0;
if cc=0 and ma5>ma20 and entertime then begin
cc:=1;
zs:=c-10;
hl:=h;
end
if cc=0 and ma5<ma20 and entertime then begin
cc:=-1;
zs:=c+10;
hl:=l;
end
if cc>0 and h>hl then begin//创新高后,上移hl
hl:=h;
zs:=hl-10;
end
if cc<0 and l<hl then begin//创新低后,下移hl
hl:=l;
zs:=hl+10;
end
if time>=150000 then begin
cc:=0;
end


--  作者:FireScript
--  发布时间:2019/1/10 15:10:42
--  
你给一个普通变量赋这个全局变量的值呗。


z:t;//t是你定义的全局变量

--  作者:m1978xz
--  发布时间:2019/1/10 15:27:04
--  
感谢版主,搞定啦,原来如此简单啊图片点击可在新窗口打开查看