以文本方式查看主题

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

--  作者:zhouyun3400
--  发布时间:2010/7/29 15:54:05
--  请版主帮忙

//准备中间变量
h30:ref(hhv(h,30),1);
l30:ref(llv(l,30),1);
中线:(h30+l30)/2;
NUM:=TBUYHOLDINGEX(\'84115\',\'\',1)+(0-TSELLHOLDINGEX(\'84115\',\'\',1));
DEBUGOUT(\'84115THOLDING=%.0f\',NUM);
DEBUGFILE(\'D:\\My Documents\\我的文件\\ControlCenter3\\海通期货金字塔交易终端\\84115.TXT\',\'84115THOLDING=%.0f\',NUM);

//建立多头建仓条件
long:=h>h30 and time>091000 and time<145200;
if long then
   begin
   sellshort(holding<0,0,limitr,h30);
   buy(holding=0,1,limitr,h30);
   end
  
pk:=c>h30-(1*MINDIFF) and time>091000 and time<145200; 
Tsellshort(pk and NUM<0,0,mkt,0,0,\'84115\');
dt:=c>h30 and time>091000 and time<145200;
Tbuy(dt and NUM=0,1,mkt,0,0,\'84115\');
  
//画出多头止损线
PARTLINE(holding>0,l30,colorred);

//建立空头建仓条件
short:=l<l30 and time>091000 and time<145200;
if short then
   begin
   sell(holding>0,0,limitr,l30);
   buyshort(holding=0,1,limitr,l30);
   end
  
pd:=c<l30+(1*MINDIFF) and time>091000 and time<145200;  
Tsell(pd and NUM>0,0,mkt,0,0,\'84115\');
kt:=l30>c and time>091000 and time<145200;
Tbuyshort(kt and NUM=0,1,mkt,0,0,\'84115\');
  
//画出空头止损线
PARTLINE(holding<0,h30,colorgreen);

//收盘前平仓
sell(time>145500 and holding>0,0,limitr,OPEN);
sellshort(time>145500 and holding<0,0,limitr,OPEN);
Tsell(time>145500,0,mkt,0,0,\'84115\');
Tsellshort(time>145500,0,mkt,0,0,\'84115\');

 

上面的公式我采用5分钟K线实盘后台交易,中段的平空开多、平多开空都没有问题,就是尾盘的收盘前平仓指令不执行,加上指定卖持(指定买持)都没有效果。请版主帮我看一下公式,指出问题之所在,不胜感谢!


--  作者:fly
--  发布时间:2010/7/29 17:06:04
--  
 时间函数用的不对,应用currenttime
tSELL(currenttime>145500 and tHOLDING>0,0,lmt,DYNAINFO(20)-3*MINDIFF);
tSELLSHORT(currenttime>145500 and tHOLDING<0,0,lmt,DYNAINFO(21)+3*MINDIFF);

 


--  作者:zhouyun3400
--  发布时间:2010/7/29 18:23:34
--  
图片点击可在新窗口打开查看
--  作者:admin
--  发布时间:2010/7/29 23:45:58
--  

试试去掉最后的指定帐号 \'84115\'