以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  发现cross函数的问题  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=78071)

--  作者:PierreHuang
--  发布时间:2015/4/28 11:03:55
--  发现cross函数的问题
variable:flag=0;

myBbi:stkindi(\'\',\'mybbisys.mybbi\',0,6),LINETHICK2,COLORRED;
myMaD10:stkindi(\'\',\'mybbisys.myMaD10\',0,6),LINETHICK2,COLORBLUE;

5LowCloseP:=ref(llv(close,5),1);
5LowOpenP:=ref(llv(open,5),1);
5LowP:MIN(5LowCloseP,5LowOpenP),COLORBLUE;

if cross(5LowP,myBbi) then begin
flag:=1;
end

if cross(myBbi,5LowP) then begin
flag:=0;
end
以上代码全局变量flag是正常的,但如果改为:
if cross(5LowP,myBbi) and cross(5LowP,myMaD10) then begin
flag:=1;
end

if cross(myBbi,5LowP) and cross(myMaD10,5LowP) then begin
flag:=0;
end
全局变量,flag就一直是1,请教版主,这个是什么问题,非常感谢。

--  作者:jinzhe
--  发布时间:2015/4/28 11:07:34
--  
说明cross(myBbi,5LowP) and cross(myMaD10,5LowP) 这两个条件永远都没有同时成立的情况