以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  为什么不停的,每根K线都开平仓?这源码有问题?很简单的  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=141855)

--  作者:zengxing
--  发布时间:2016/10/26 19:26:40
--  为什么不停的,每根K线都开平仓?这源码有问题?很简单的
p:=26;
s:=12;
m:=9;
atrm:=20;

multipler:=10;
pp:=NUMTOSTR(p,0);
ss:=NUMTOSTR(s,0);
mm:=NUMTOSTR(m,0);
atrmm:=NUMTOSTR(atrm,0);
macd:=stkindi(\'\',\'macd.macd1(\'&pp&\',\'&ss&\',\'&mm&\')\',21,75);
diff:=stkindi(\'\',\'macd.diff(\'&pp&\',\'&ss&\',\'&mm&\')\',21,75);
atr:=stkindi(\'\',\'atr.atr(\'&atrmm&\')\',21,75);


if cross(macd,0) and  diff>=0.03 or (hhv(h,10)-LLV(l,10))>=0.15 then begin
   sellshort(1,0,market);
   buy(holding=0,1,market);
end
 
if cross(0,macd) and  diff>=0.03  or  (hhv(h,10)-LLV(l,10))>=0.15 then begin
   sell(1,0,market);
   buyshort(holding=0,1,market);
end

if openprofit/multipler>1.5*atr then begin
   sell(1,0,marketr);
   sellshort(1,0,market);
end
 
if openprofit<0 and abs(openprofit)/multipler>1.5*atr then begin
   sell(1,0,marketr);
   sellshort(1,0,market);
end

--  作者:jinzhe
--  发布时间:2016/10/27 8:46:14
--  

cross(macd,0) and  diff>=0.03 or (hhv(h,10)-LLV(l,10))>=0.15

这句里面的or是先判断还是and先判断?