以文本方式查看主题

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

--  作者:量化马甲
--  发布时间:2014/7/11 22:09:35
--  部分代码,请帮忙看看有无问题
cu1:=\'cu00\';
CUKD:=;
CUPD:=;
CUKK:=;
CUPK:=;
tbuy(CUKD and tbuyholdingex(\'\',cu1,1)<1,10,mkt,0,0,\'\',cu1);
tbuyshort(CUKK and tsellholdingex(\'\',cu1,1)<1,10,mkt,0,0,\'\',cu1);
tsell(CUPD and tbuyholdingex(\'\',cu1,1)>0,0,mkt,0,0,\'\',cu1);
tsellshort(CUPD and tsellholdingex(\'\',cu1,1)>0,0,mkt,0,0,\'\',cu1);
if (hhv(topenprofit,tenterbars+1)-topenprofit)/hhv(topenprofit,tenterbars+1)>=0.2 and tbuyholdingex(\'\',cu1,1)>0 then begin
tsell(1,tbuyholdingex(\'\',cu1,1),mkt,0,0,\'\',cu1);
end
if (hhv(topenprofit,tenterbars+1)-topenprofit)/hhv(topenprofit,tenterbars+1)>=0.2 and tsellholdingex(\'\',cu1,1)>0 then begin
tsellshort(1,tsellholdingex(\'\',cu1,1),mkt,0,0,\'\',cu1);
end
if tavgenterpriceex2(\'\',cu1,0)-c>200*mindiff then begin
tsell(1,tbuyholdingex(\'\',cu1,1),mkt,0,0,\'\',cu1);
end
if c-tavgenterpriceex2(\'\',cu1,0)>200*mindiff then begin
tsellshort(1,tsellholdingex(\'\',cu1,1),mkt,0,0,\'\',cu1);
end
WCJ:=tremainqty(0,\'\',cu1);
if WCJ<>0 then begin
A:=WCJ;
end
if WCJ>0 then begin
tcancelex(1,0,\'\',cu1);
tbuy(WCJ=0,A,mkt,0,0,\'\',cu1);
tbuyshort(WCJ=0,A,mkt,0,0,\'\',cu1);
end
当前持仓量:=tbuyholdingex(\'\',cu1,1)+tsellholdingex(\'\',cu1,1);
当前可用资金:=taccount(19);
debugout(\'当前持仓量%.2f\',当前持仓量 );
debugout(\'当前可用资金%.2f\',当前可用资金 );

--  作者:jinzhe
--  发布时间:2014/7/14 8:59:56
--  
你本地编译通过即算作无问题