欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件交易策略发布专区 → [分享]2分钟boll日内交易系统(附源码)

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有40243人关注过本帖树形打印复制链接

主题:[分享]2分钟boll日内交易系统(附源码)

帅哥哟,离线,有人找我吗?
yycyyyc321
  31楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:3 积分:0 威望:0 精华:0 注册:2016/5/17 10:49:05
  发帖心情 Post By:2016/5/28 10:23:07 [只看该作者]

我给作者加注释吧。
以下内容为程序代码:

1 //说明:
2 //1.这是一个基于boll的交易系统;
3 //2.使用周期2分钟;
4 //3.程序中使用了加载策略;提前下单策略;和小震荡过滤;
5 //4.程序中使用了反幽灵交易法,即大赚一次休息一段时间。
6 // 适用软件:金字塔
7 // 本程序的缺点:主观的因素比较多。
8
9 //股指期货自动交易程序(2分钟BOLL日内趋势交易系统)
10 //编制:
11 //日期:2012年5月27日定稿。
12 //适用于500股指连续
13 //http://www.weistock.com/bbs/dispbbs.asp?boardid=10&id=56549&authorid=0&page=0&star=1
14     
15 {
16 //加密及期限
17 drawtextex(1,1,200,800,engincode());
18 rzb:=strcmp(engincode(),'aaaaaaaaaa');
19 if rzb<>0 then
20 begin
21     drawtextex(1,1,500,500,'程序不能在此计算机上运行');
22     exit;
23 end
24 有效期:1121230,linethick0;
25 账号:11111,linethick0;
26 zhh:=strtonum(taccount(1));
27 if zhh<>账号 then
28 begin
29     drawtextex(1,1,500,500,'授权账号不正确,程序无法使用');
30     exit;
31 end
32
33
34 if date>有效期 then
35 begin
36     drawtextex(1,1,500,500,'已过授权时间,程序无法使用');
37     exit;
38 end
39
40 if datatype<>14 then
41 begin
42     drawtextex(1,1,50,950,'本程序使用2分钟周期,请切换到Mn周期');
43     exit;
44 end
45 }
46 //========================================================
47
48 //交易控制变量
49 variable:a1=1;//记录K线个数,也是用于幽灵法则
50 variable:a2=1;//是一个记录标志位,由反幽灵法则决定,决定是否开仓
51
52 //**********************************
53 //交易手数:
54 tn:=1;
55
56 //最大持仓量
57 cx:=6;
58
59 //提前下单量(秒)
60 xd:=3;
61
62 //交易时间区间
63 p1:=time>091500 and time<151000;
64 p2:=if(islastbar,dynainfo(207),time);//当前周期的时分秒
65 p3:=time0-timetot0(p2),linethick0;//就是当前时刻精确到秒跟周期的时分秒对比,用于表明系统延时的
66
67 //********************************
68 r1:=barslast(date<>ref(date,1));//区分当期交易日和上一个交易日那根k线距离当期k线的距离,用于统计日盈亏
69 r2:=ref(o,r1);//当期交易日的开盘价
70
71 //********************************
72 hd:=if(islastbar,3,1.2);//该周期是否为最后一个周期,是就为3,否则为1.2
73 hd1:=if(islastbar,3,0.1);//该周期是否为最后一个周期,是就为3,否则为1.2,这个用于收盘前清仓的追单
74
75 //********************************
76 cc:=(h+l+o+c)/4;//开高低收平均价
77 mid:=ma(cc,26);//中轴线
78 upper:=mid+1.7*std(cc,26);//上线
79 lower:=mid-1.7*std(cc,26);//下线
80
81 //********************************
82 r12:=asset-ref(asset,135);//净资产对比前一天同一时刻发生的变化,135为一天有多少个两分钟
83 r13:=valuewhen(r1=134,r12);//临近收盘进行刷新
84
85 if r13>6000*cx and a2>0 then //当净资产增长较多时
86 begin
87     a1:=barpos;//记录下这是第几根K线
88     a2:=-1;
89 end
90 r16:=if(barpos-a1>810,1,-1);//当大赚后,810根K线内r16都为-1
91 if r16>0 and r1<2 then a2:=1;
92
93 if abs(r2-c)>34 or (abs(r2-c)>24 and r1<40) then c6:=1;
94 r17:=r16>0 or c6>0;//反幽灵法则的体现
95 //********************************
96 q2:=valuewhen(r1=0,sum(h-l,270)/270);//前270个周期高低差值平均值
97 r20:=upper-lower<6.5*q2;//当bolling敞口小于一定程度后,才可以买入
98
99 //********************************
100 nn:=4*q2;
101 if holding>0 and o-l>=nn and enterbars>0 then//当反向趋势明显时,平仓,属于止损操作
102 begin
103     sell(holding>0,holding,limitr,o-nn-hd);
104 end
105 if holding<0 and h-o>=nn and enterbars>0 then
106 begin
107     sellshort(holding<0,abs(holding),limitr,o+nn+hd);
108 end
109
110
111 //********************************
112 //r20指上下线敞口小于特定值,p1位交易时间段,p3在前面,r17也在前面
113 if c>upper and r20 and h-upper<3.5*q2 and p1 and p3<=xd and r17>0 then
114 begin
115     buy(holding<cx,tn,limitr,c+hd1);
116 end
117 if c<lower and r20 and lower-l<3.5*q2 and p1 and p3<=xd and r17>0 then
118 begin
119     buyshort(abs(holding)<cx,tn,limitr,c-hd1);
120 end
121
122 //---------------------------------
123 if holding>0 and l<mid then
124 begin
125     sell(1,0,limitr,c-hd1);
126 end
127 if holding<0 and h>mid then
128 begin
129     sellshort(1,0,limitr,c+hd1);
130 end
131
132
133 //********************************
134
135 //收盘前清仓
136 if p2>=151300 then
137 begin
138     sellshort(holding<0,0,limitr,c+hd1);
139     sell(holding>0,0,limitr,c-hd1);
140     c6:=-1;
141     c1:=1;
142 end
143
144
145
146 //*************************************
147 交易总数:totaltrade,colorwhite,linethick0;
148 盈亏:asset-1000000,colorred,linethick1,noaxis;
149 日盈亏:asset-ref(asset,r1+1),noaxis,colorred,linethick0;
150 持仓:holding,colorwhite,linethick0;
151
152 rr1:=barslast(month<>ref(month,1));
153 月盈利:asset-ref(asset,rr1+1),linethick0;
154
155 variable:hc=0;
156 回撤:hhv(盈亏,30000)-盈亏,linethick0,coloryellow;
157 if 回撤>hc then hc:=回撤;
158 最大回撤:hc,linethick0,coloryellow;
159

 回到顶部
总数 31 上一页 1 2 3 4