以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  请教关于variable  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=59264)

--  作者:punkcat401
--  发布时间:2013/11/27 10:46:12
--  请教关于variable

多头:多头条件A成立后,一直有效,当条件B成立时,条件A失效。

空头:空头条件B成立后,一直有效,当条件A成立时,条件B失效。

 

variable:M1=0;
variable:M2=0;

 

IF 条件A then begin

M1:=1;

M2:=0;

END

IF M1=1 then buy;

 

IF 条件B then begin

M1:=0;

M2:=1;

END

IF M2=1 then buyshort;

 

是这样写的吗

[此贴子已经被作者于2013/11/27 10:47:32编辑过]

--  作者:jinzhe
--  发布时间:2013/11/27 11:03:13
--  

IF 条件A  and holding=0 then begin

buy;

M1:=1;

M2:=0;

END

 

IF 条件B and holding=0 then begin

buyshort;

M1:=0;

M2:=1;

END