以文本方式查看主题

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

--  作者:chockstick
--  发布时间:2013/5/30 13:44:55
--  帮忙检查下程序

DayVarValue1:ma(close,5);//

DayVarValue2:ma(close,10);

//开仓条件
DayIntervalValue:=DayVarValue1-DayVarValue2;
KD:=ref(low,1)<DayVarValue2 and ref(close,1)>=DayVarValue2 and date>=1120101 and time<=143000 ;          //开多条件
//PD:=ref(close,1)>=(DayVarValue2+0.5*DayIntervalValue);         //平多条件
PD:=(ref(close,1)>=(DayVarValue2+ratio*DayIntervalValue)) or (ref(close,1)<DayVarValue2 and ref(close,2)<DayVarValue2); 
KK:=ref(high,1)>DayVarValue1 and ref(close,1)<DayVarValue1  and date>=1120101 and time<=143000;          //开空条件
PK:=(ref(close,1)<=(DayVarValue1-0.5*DayIntervalValue)) or (ref(close,1)>DayVarValue1 and ref(close,2)>DayVarValue1);        //平空条件
//PD:=(ref(close,1)>=(DayVarValue2+ratio*DayIntervalValue)) or (ref(close,1)<DayVarValue2 and ref(close,2)<DayVarValue2); 

BUY(KD AND HOLDING=0,1,OPEN);          //开多信号
SELL(HOLDING>0 AND PD,1,OPEN);                       //平多信号
BUYSHORT(KK AND HOLDING=0,1,OPEN);     //开空信号
SELLSHORT(holding<0 AND PK,1,OPEN);                  //平空信号

if time>=150000 then begin
sell(holding>0,1,market);
sellshort(holding<0,1,market);
end

----------------------------------------------------

测试正常,为什么没信号出来?股指连续5min周期上


--  作者:jinzhe
--  发布时间:2013/5/30 13:50:17
--  

公式中下单函数的价位参数写错了

要么是buy(cond,vol,limitr,open);

要么是buy(cond,vol,market);

写成buy(cond,vol,open);是不对的


--  作者:chockstick
--  发布时间:2013/5/30 13:56:35
--  
是的噢。。谢谢啦