: | : | :期货程序化 | :期货程序化研究 | :期货量化学习 | :期货量化 |
返回列表 发帖

[金字塔源码] 2分钟boll日内交易系统

[金字塔源码] 2分钟boll日内交易系统

说明:1.这是一个基于boll的交易系统;

         2.使用周期2分钟;
         3.程序中使用了加载策略;提前下单策略;和小震荡过滤;
         4.程序中使用了反幽灵交易法,即大赚一次休息一段时间。
本程序的缺点:主观的因素比较多。

  1. //股指期货自动交易程序(2分钟BOLL日内趋势交易系统)
  2. //编制:
  3. //日期:2012年5月27日定稿。


  4. {
  5. //加密及期限
  6. drawtextex(1,1,200,800,engincode());
  7. rzb:=strcmp(engincode(),\'aaaaaaaaaa\');
  8. if rzb<>0 then
  9. begin
  10. drawtextex(1,1,500,500,\'程序不能在此计算机上运行\');
  11. exit;
  12. end
  13. 有效期:1121230,linethick0;
  14. 账号:11111,linethick0;
  15. zhh:=strtonum(taccount(1));
  16. if zhh<>账号 then
  17. begin
  18. drawtextex(1,1,500,500,\'授权账号不正确,程序无法使用\');
  19. exit;
  20. end
  21.                        
  22. if date>有效期 then
  23. begin
  24. drawtextex(1,1,500,500,\'已过授权时间,程序无法使用\');
  25. exit;
  26. end


  27. if datatype<>14 then
  28. begin
  29. drawtextex(1,1,50,950,\'本程序使用2分钟周期,请切换到Mn周期\');
  30. exit;
  31. end
  32. }
  33. //========================================================
  34. //交易控制变量
  35. variable:a1=1;
  36. variable:a2=1;


  37. //**********************************
  38. //交易手数:
  39. tn:=1;


  40. //最大持仓量
  41. cx:=6;


  42. //提前下单量(秒)
  43. xd:=3;


  44. //交易时间区间
  45. p1:=time>091500 and time<151000;
  46. p2:=if(islastbar,dynainfo(207),time);
  47. p3:=time0-timetot0(p2),linethick0;


  48. //********************************
  49. r1:=barslast(date<>ref(date,1));
  50. r2:=ref(o,r1);


  51. //********************************
  52. hd:=if(islastbar,3,1.2);
  53. hd1:=if(islastbar,3,0.1);


  54. //********************************
  55. cc:=(h+l+o+c)/4;
  56. mid:=ma(cc,26);
  57. upper:=mid+1.7*std(cc,26);
  58. lower:=mid-1.7*std(cc,26);


  59. //********************************
  60. r12:=asset-ref(asset,135);
  61. r13:=valuewhen(r1=134,r12);


  62. if r13>6000*cx and a2>0 then
  63. begin
  64. a1:=barpos;
  65. a2:=-1;
  66. end
  67. r16:=if(barpos-a1>810,1,-1);
  68. if r16>0 and r1<2 then a2:=1;


  69. if abs(r2-c)>34 or (abs(r2-c)>24 and r1<40) then c6:=1;
  70. r17:=r16>0 or c6>0;
  71. //********************************
  72. q2:=valuewhen(r1=0,sum(h-l,270)/270);
  73. r20:=upper-lower<6.5*q2;


  74. //********************************
  75. nn:=4*q2;
  76. if holding>0 and o-l>=nn and enterbars>0 then
  77. begin
  78. sell(holding>0,holding,limitr,o-nn-hd);
  79. end
  80. if holding<0 and h-o>=nn and enterbars>0 then
  81. begin
  82. sellshort(holding<0,abs(holding),limitr,o+nn+hd);
  83. end                               


  84. //********************************
  85. if c>upper and r20 and h-upper<3.5*q2 and p1 and p3<=xd and r17>0 then
  86. begin
  87. buy(holding<cx,tn,limitr,c+hd1);
  88. end
  89. if c<lower and r20 and lower-l<3.5*q2 and p1 and p3<=xd and r17>0 then
  90. begin
  91. buyshort(abs(holding)<cx,tn,limitr,c-hd1);
  92. end


  93. //---------------------------------
  94. if holding>0 and l<mid then
  95. begin
  96. sell(1,0,limitr,c-hd1);
  97. end
  98. if holding<0 and h>mid then
  99. begin
  100. sellshort(1,0,limitr,c+hd1);
  101. end
  102.                        
  103. //********************************                               
  104. //收盘前清仓
  105. if p2>=151300 then
  106. begin
  107. sellshort(holding<0,0,limitr,c+hd1);
  108. sell(holding>0,0,limitr,c-hd1);
  109. c6:=-1;
  110. c1:=1;
  111. end                               
  112.                        
  113. //*************************************
  114. 交易总数:totaltrade,colorwhite,linethick0;
  115. 盈亏:asset-1000000,colorred,linethick1,noaxis;
  116. 日盈亏:asset-ref(asset,r1+1),noaxis,colorred,linethick0;
  117. 持仓:holding,colorwhite,linethick0;


  118. rr1:=barslast(month<>ref(month,1));
  119. 月盈利:asset-ref(asset,rr1+1),linethick0;


  120. variable:hc=0;
  121. 回撤:hhv(盈亏,30000)-盈亏,linethick0,coloryellow;
  122. if 回撤>hc then hc:=回撤;
  123. 最大回撤:hc,linethick0,coloryellow;
复制代码

论坛官方微信、群(期货热点、量化探讨、开户与绑定实盘)
 
期货论坛 - 版权/免责声明   1.本站发布源码(包括函数、指标、策略等)均属开放源码,用意在于让使用者学习程序化语法撰写,使用者可以任意修改语法內容并调整参数。仅限用于个人学习使用,请勿转载、滥用,严禁私自连接实盘账户交易
  2.本站发布资讯(包括文章、视频、历史记录、教材、评论、资讯、交易方案等)均系转载自网络主流媒体,内容仅为作者当日个人观点,本网转载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。本网不对该类信息或数据做任何保证。不对您构成任何投资建议,不能依靠信息而取代自身独立判断,不对因使用本篇文章所诉信息或观点等导致的损失承担任何责任。
  3.本站发布资源(包括书籍、杂志、文档、软件等)均从互联网搜索而来,仅供个人免费交流学习,不可用作商业用途,本站不对显示的内容承担任何责任。请在下载后24小时内删除。如果喜欢,请购买正版,谢谢合作!
  4.龙听期货论坛原创文章属本网版权作品,转载须注明来源“龙听期货论坛”,违者本网将保留追究其相关法律责任的权力。本论坛除发布原创文章外,亦致力于优秀财经文章的交流分享,部分文章推送时若未能及时与原作者取得联系并涉及版权问题时,请及时联系删除。联系方式:http://www.qhlt.cn/thread-262-1-1.html
如何访问权限为100/255贴子:/thread-37840-1-1.html;注册后仍无法回复:/thread-23-1-1.html;微信/QQ群:/thread-262-1-1.html;网盘链接失效解决办法:/thread-93307-1-1.html

返回列表