以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 请求老师帮忙检查完善一下程序 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=50694) |
-- 作者:sisosm -- 发布时间:2013/4/5 20:01:19 -- 请求老师帮忙检查完善一下程序 我参照别人的程序写了个简单股指期货日内交易程序,但是还是有问题,请老师帮忙指导,检查改正下错误,谢谢。
策略:9:15分钟股指期货开盘,以1分钟为K线,到9:30分钟,判断这前15分钟的最高价与最低价,9:30分01秒起,若当前价高于最高价则开盘,若低于最低价则开空,止损8点(40个价位),止赢20点(100个价位),每天只开仓一次,也就是开盘了就不再开空,反之也是。15:00钟,如还有持仓,则平,如无持仓,也结束一切交易(也就是如果前面没有达到开仓条件也不再开仓)。
下面是参照别人的改的,请老师指正,谢谢。
input:n(2,1,100); if h>zuigao and M>15 and n1=0 and time<151500 then begin if l<zuidi and M>15 and n1=0 and time<151500 then begin if c-enterprice>=8 and holding<0 then sellshort(holding<0,0,market); if enterprice-c>=8 and holding>0 then sell(holding>0,0,market);//止损 if c-enterprice>=20 and holding>0 then sell(holding>0,0,market); if enterprice-c>=20 and holding<0 then sellshort(holding<0,0,market);//止盈 if time>=150000 then begin if datatype<>1 then exit;
|
-- 作者:sisosm -- 发布时间:2013/4/5 21:06:27 -- 我重新改动了一下,感觉基本可以用了。但测试当日时,不知为何赢利可达7220元(我是止赢20个点,6000元),亏抽也是3440元(我是止损8个点,2400元),不知为何有这样大的相差。改动如下,请老师指正,谢谢:
input:ss(1,1,100,1);//交易手数 if h>HH and time>093000 and n1=0 and time<150000 then begin if l<LL and time>093000 and n1=0 and time<150000 then begin if c-enterprice>=8 and holding<0 then sellshort(holding<0,0,market); if enterprice-c>=8 and holding>0 then sell(holding>0,0,market);//止损 if c-enterprice>=20 and holding>0 then sell(holding>0,0,market); if enterprice-c>=20 and holding<0 then sellshort(holding<0,0,market);//止盈 if time>=150000 then begin if datatype<>1 then exit; |
-- 作者:王锋 -- 发布时间:2013/4/5 22:47:46 -- 这种图表交易用的是K线中的价格,不会那么精确的。 如果你需要尽可能的精确的数据,那么就因该使用更小的周期进行测试 |