以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  金字塔软件问题提交  (http://weistock.com/bbs/list.asp?boardid=2)
----  可能是BUG:11:30无信号平仓问题  (http://weistock.com/bbs/dispbbs.asp?boardid=2&id=31429)

--  作者:mao100003801
--  发布时间:2012/12/12 11:51:45
--  可能是BUG:11:30无信号平仓问题

这个问题反映了几次,没有解决。因为是自己编的模型,所以一直在找原因。

 

今天我的另一个模型也出现了同样问题。该模型已经正常运作一个月有余,向来都是选择自动持仓同步的,以前没有问题。今天是第一次出现,并且在11:30后不停地发送平仓请求。

 

值得注意的是::该模型是在另一台电脑上运行!而该电脑与其他任何电脑无关联,用的也是完全不同的金字塔账号和券商账号。

 

恐怕此处是新版金字塔的BUG ,请官方给以重视,认真查找原因。


--  作者:王锋
--  发布时间:2012/12/12 12:06:19
--  
请将问题公式的代码贴出来,我们帮你分析一下问题原因
--  作者:mao100003801
--  发布时间:2012/12/12 12:21:01
--  

//条件定义
cond1:=ma(close,5)>ma(close,10) and condzhenfu and conddthk and condrsidt;//开多条件
cond3:=ma(close,10)>ma(close,5)+0.4  and c<MA(c,10); //平多条件
cond31:=c<ma(c,10) and ref(c,1)<ref(ma(c,10),1);//连续低于10日均线平多
cond2:=ma(close,10)>ma(close,5) and condkthk and condrsikt and  c<Ma(c,10) ;//开空条件cond2
cond4:=ma(close,5)>ma(close,10) and condzhenfu and conddthk and condrsidt and c>MA(c,10);//平空条件

//买开执行
if cond1  and time <144500 and time>100000 then
 begin
 if holding<0 then sp0:SELLSHORT(1,unit,THISCLOSE),ORDERQUEUE;//平空 
 if holding=0 then bk1:buy(1,unit,THISCLOSE),ORDERQUEUE;//开多
 end
//平多:
if (cond3 or cond31) and enterbars>=1 then
 begin
 if  holding>0 then sp1:SELL(1,unit,THISCLOSE),ORDERQUEUE;//平多
 end

//卖开执行
if cond2  and time <144500 and time>100000 then
 begin
 if holding>0 then  bp0:SELL(1,unit,THISCLOSE),ORDERQUEUE;//平多
 if holding=0 then  sk1:buySHORT(1,unit,THISCLOSE),ORDERQUEUE;//开空
 end
//平空条件:
if cond4  and enterbars>=1 then
 begin
 if holding<0 then bp1:SELLSHORT(1,unit,THISCLOSE),ORDERQUEUE;//平空
 end

//多单止损
cond32:=close<Ma(close,5);
if holding>0 then
begin
bkpp:=AVGENTERPRICE;
if close<bkpp-lspd and cond32 then 多单止损:SELL(1,unit,THISCLOSE);//平多
end

//空单止损
cond41:=close>MA(close,5);
if holding<0 then
begin
skpp:=AVGENTERPRICE;
if close>skpp+lspk and cond41 then 空单止损:SELLSHORT(1,unit,THISCLOSE);//平空
end

{

//收盘平仓
if time >150600 and holding<>0 then
begin
 if holding<0 then 收盘平空:SELLSHORT(1,0,market);//平空
 if holding>0 then 收盘平多:SELL(1,0,market);//平多
 end

}
日赢:asset-ref(asset,barslast(date<>ref(date,1))+1),linethick0 ;

 

 


--  作者:mao100003801
--  发布时间:2012/12/12 12:22:58
--  

问题是:另外一台电脑上另一个模型,向来自动同步持仓的,以前没有任何问题,今天也出现了。


--  作者:王锋
--  发布时间:2012/12/12 12:52:26
--  

公式代码不全,无法分析出原因。

 

cond1:=ma(close,5)>ma(close,10) and condzhenfu and conddthk and condrsidt;//开多条件
cond3:=ma(close,10)>ma(close,5)+0.4  and c<MA(c,10); //平多条件
cond31:=c<ma(c,10) and ref(c,1)<ref(ma(c,10),1);//连续低于10日均线平多
cond2:=ma(close,10)>ma(close,5) and condkthk and condrsikt and  c<Ma(c,10) ;//开空条件cond2
cond4:=ma(close,5)>ma(close,10) and condzhenfu and conddthk and condrsidt and c>MA(c,10);//平空条件

 

上述的条件中,无法确定你在中午11:30后是否会因为你代码问题产生信号闪烁。

 

如果你不方面贴出全部代码,建议你使用金字塔的调试功能

http://www.weistock.com/bbs/dispbbs.asp?boardid=4&Id=332 问题4.

 

通过日志输出,看看到底是哪个变量导致中午会出现变化,追溯该变量的变化过程,最终找到问题