以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  全局变量的使用  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=81160)

--  作者:txzc8888
--  发布时间:2015/7/15 13:37:10
--  全局变量的使用
老师您好!刚才与您通过电话,想请教全局变量的使用。我想控制当天开的仓,当天不能平仓。我想达到类似“lastentrydate<>date then sell”这样的效果,全局变量该怎么用?
--  作者:jinzhe
--  发布时间:2015/7/15 13:49:01
--  

variable:bj=0;

if 开仓条件 and holding=0 then begin

   buy(1,1,market);

   bj:=date;

end

 

if 平仓条件 and holding>0 and date>bj then sell(1,0,market);

 

类似这样的,用全局变量bj来记录开仓的日期


--  作者:txzc8888
--  发布时间:2015/7/15 13:50:27
--  
谢谢,老师