以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [求助]有请版主,写的程序为什么不执行测试?  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=25471)

--  作者:厚道大哥
--  发布时间:2012/9/13 17:56:49
--  [求助]有请版主,写的程序为什么不执行测试?
v1:=(3*c+l+h+o)/6;
v2:=ma(v1,m);
refv2:=ref(v2,1);
v3:=ma(v1,n);
refv3:=ref(v3,1);
sl01:=round(ref(c,1)*1.012);
sl02:=round(ref(c,1)*0.988);

buy(cross(v2,refv2),65%,thisclose);
sell(cross(refv2,v2),100%,thisclose) or sell(cross(sl02,l),100%,market);
buyshort(cross(refv2,v2),65%,thisclose);
sellshort(cross(v2,refv2),100%,thisclose)or sellshort(cross(h,sl01),100%,market);

上面是我写的程序交易,可是在测试里怎么不执行呢???怪

--  作者:王锋
--  发布时间:2012/9/13 18:34:50
--  
buy(cross(v2,refv2),65%,thisclose);
sell(cross(refv2,v2),100%,thisclose) or sell(cross(sl02,l),100%,market);
buyshort(cross(refv2,v2),65%,thisclose);
sellshort(cross(v2,refv2),100%,thisclose)or sellshort(cross(h,sl01),100%,market);
 
这种语法不符合金字塔的规范要求。
此外你要注意先平后开的原则,平仓语句一般要放在开仓语句前面

--  作者:厚道大哥
--  发布时间:2012/9/13 18:37:26
--  
大神版主,怎么改啊,不太习惯金字塔的语句。
--  作者:王锋
--  发布时间:2012/9/13 18:40:30
--  
sell(cross(refv2,v2) or cross(sl02,l),100%,thisclose) ;
sellshort(cross(v2,refv2) or cross(h,sl01),100%,thisclose);
 
buy(cross(v2,refv2),65%,thisclose);
buyshort(cross(refv2,v2),65%,thisclose);
 
这样改就可以了,你之前的语法结构,任何一款软件都不可能支持的

--  作者:厚道大哥
--  发布时间:2012/9/13 18:46:33
--  
为什么平仓指令一定要写在前面呢?
--  作者:王锋
--  发布时间:2012/9/13 18:51:13
--  

主要是在实盘下单操作时,如果不先平后开会导致下单紊乱问题。

就跟你平时做交易一样,平仓反手,你可能是要先平仓再开仓这样的顺序流程