以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  求老师帮忙看下该交易系统是否有什么问题  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=50625)

--  作者:chockstick
--  发布时间:2013/4/3 14:35:07
--  求老师帮忙看下该交易系统是否有什么问题

我用的是股指5min周期的数据,然后每次开平仓5手

然后日内三点平仓,我测试过代码说正常,但是交易信号没有显示出来,不知道什么缘故

老师,帮忙看下

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

 DayVarValue1:=ma1;

DayVarValue2=ma2;

KD:=ref(close,2)>=DayVarValue1 and ref(close,1) >=DayVarValue1 and date>=20120101 and time<=0.143000000 and  time>=0.093000000;          //开多条件
PD:=ref(close,2)<=DayVarValue1 and ref(close,1) <=DayVarValue1;         //平多条件
KK:=ref(close,2)<=DayVarValue2 and ref(close,1)  <=DayVarValue2  and date>=20120101 and time<=0.143000000 &&time>=0.093000000;          //开空条件
PK:=ref(close,2)>=DayVarValue2 and ref(close,1) >=DayVarValue2;        //平空条件

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

if time>=150000 then begin       //收盘前15分钟平掉日内开的仓位
sell(holding>0,5,market);
sellshort(holding<0,5,market);
end
 

[此贴子已经被作者于2013-4-3 14:36:02编辑过]

--  作者:jinzhe
--  发布时间:2013/4/3 15:00:30
--  

DayVarValue1:=ma(c,5);

DayVarValue2:=ma(c,10);

KD:=ref(close,2)>=DayVarValue1 and ref(close,1) >=DayVarValue1 and date>=1120101 and time<=143000 and  time>=093000;          //开多条件
PD:=ref(close,2)<=DayVarValue1 and ref(close,1) <=DayVarValue1;         //平多条件
KK:=ref(close,2)<=DayVarValue2 and ref(close,1)  <=DayVarValue2  and date>=1120101 and time<=143000 and time>=093000;          //开空条件
PK:=ref(close,2)>=DayVarValue2 and ref(close,1) >=DayVarValue2;        //平空条件

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

if time>=150000 then begin       //收盘前15分钟平掉日内开的仓位
sell(holding>0,5,market);
sellshort(holding<0,5,market);
end

 

 

仔细看下date和time的函数说明,


--  作者:chockstick
--  发布时间:2013/4/3 15:06:14
--  

你好,我把日期的格式改了下,但是还是没有信号出来,不知道是怎么回事?


--  作者:jinzhe
--  发布时间:2013/4/3 15:07:38
--  
用我写的那一段代码就有信号,如果你那里没有信号,那么就是你的ma1和ma2条件不满足
--  作者:chockstick
--  发布时间:2013/4/3 15:14:37
--  

确实,我用的两个指标值是调用日间数据的值,它显示在图表上的都是准确的,但是就是没有信号出来

不知道是不是因为是调用的缘故?

DayVarValue1:STKINDI(\'\',\'varday.FORCE1\',0,6);//读取日线压力位
DayVarValue2:STKINDI(\'\',\'varday.FOOTHOLD1\',0,6);//读取日线支撑位


--  作者:chockstick
--  发布时间:2013/4/3 15:19:48
--  
但是我调用的这个指标值是基于上一交易日的数据计算得到的,所以他在今日的值是没有变动的
--  作者:jinzhe
--  发布时间:2013/4/3 15:55:22
--  

http://www.weistock.com/bbs/dispbbs.asp?BoardID=4&ID=1246&replyID=&skin=1

自行调试一下