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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件交易策略发布专区 → [原创]公布一个可以实用的自动交易程序

   

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


  共有81603人关注过本帖平板打印复制链接

主题:[原创]公布一个可以实用的自动交易程序

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


加好友 发短信
等级:论坛游民 帖子:262 积分:2802 威望:0 精华:0 注册:2011/11/17 19:20:51
  发帖心情 Post By:2012/2/14 14:22:28 [只看该作者]

不好意思代码我也没有运行过,刚才去测试了一下,发现了一个BUG,我改过来了,最高收益可以达到82万/手,年收益率在140%左右,完全可以用于实战。

参数N可以用来改变交易次数,自己可以取一个合理的值就行了。M和M1也无关紧要,只要取一个合理的值,就不会改变模型的性质。代码如下:

 

 

 

//股指期货自动交易程序
//编制:zg611029 qq:2313936161

//上下轨和中轨的距离

input:n(13,1,20,1);

//中轴偏移值

input:m(70,-200,200,1);

//回撤止赢点数

input:m1(24,5,30,1);

//交易手数:
tn:=1;

r1:=barslast(day-ref(day,1)<>0);

r5:ref(o,r1)+0.1*m;
r6:r5+n;
r7:r5-n;

if time>091500 and time<150000 then
begin

if r1=0 and holding=0 then
begin
buy(h>r6,tn,limitr,r6);
buyshort(l<r7,tn,limitr,r7);
end

if cross(h,r6) then
begin
buy(holding=0,tn,limitr,r6);
end
if cross(r7,l) then
begin
buyshort(holding=0,tn,limitr,r7);
end
if holding>0 and cross(r5,l) then
begin
sell(1,0,limitr,r5);
end
if holding<0 and cross(h,r5) then
begin
sellshort(1,0,limitr,r5);
end
end

//回撤止赢

r10:=enterbars;

r11:=llv(l,r10+1);

r12:=hhv(h,r10+1);
if time>091500 and time<150000 then
begin
if holding>0 and r12-c>m1 and r10>=1 then

begin

sell(1,0,thisclose);

end

if holding<0 and c-r11>m1 and r10>=1 then

begin

sellshort(1,0,thisclose);

end
end
//收盘前清仓
if time>=151000 then
begin
sellshort(holding<0,0,thisclose);
sell(holding>0,0,thisclose);
end

持仓:holding,colorwhite,linethick0;
交易总数:totaltrade,colorwhite,linethick0;
盈亏:asset-1000000,noaxis,colorred


 回到顶部
总数 82 1 2 3 4 5 6 7 8 9 下一页