: | : | :期货量化学习 | :期货量化 |
返回列表 发帖

[金字塔源码] 创丰1号策略(代码公开)[金字塔模型]

[金字塔源码] 创丰1号策略(代码公开)[金字塔模型]

  1. abb:=not(islastbar) or (islastbar and tholding2=0);
  2. ma1:ma(c,5);
  3. ma2:ma(c,10);
  4. ma3:ma(c,20);
  5. ma4:ma(c,60);

  6. 创丰1号-A:VALUEWHEN(TIME=0916,O),COLORMAGENTA;

  7. DIFF := EMA(CLOSE,12) - EMA(CLOSE,26);
  8. DEA  := EMA(DIFF,9);
  9. MACD1 := 2*(DIFF-DEA), COLORSTICK;

  10. VARIABLE: aspect=0;
  11. VARIABLE: stopprice=0;
  12. VARIABLE: stopnum = 1.6;

  13. RUNMODE:0;   

  14. if barpos = 0 then
  15.   stopprice := l - stopnum;

  16. if aspect = 0 then
  17. begin

  18. if l <= stopprice then
  19. begin

  20.   aspect:= 1;
  21.   stopprice := h+stopnum;
  22. end


  23. if l - stopnum > stopprice then
  24.   stopprice := l-stopnum;
  25. end

  26. if aspect = 1 then
  27. begin

  28. if h >= stopprice then
  29. begin

  30.   aspect:= 0;
  31.   stopprice := l-stopnum;
  32. end


  33. if h + stopnum < stopprice then
  34.   stopprice := h+stopnum;
  35. end


  36. RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
  37. K:=SMA(RSV,3,1);
  38. D:=SMA(K,3,1);
  39. J:=3*K-2*D;

  40. 手数:=1;
  41. a1:=k>ref(k,1) and c-ENTERPRICE>=9 ;
  42. a2:=k<ref(k,1) and c-ENTERPRICE<=-9 ;


  43. EMA13:=EMA(C,10),COLORWHITE;
  44. EMA21:=EMA(C,21),COLORYELLOW;
  45. EMA34:=EMA(C,34),COLORFF00FF;
  46. EMA60:=MA(C,55),COLORFFCC66;
  47. X1:=(C+L+H)/3;
  48. X2:=EMA(X1,5);
  49. X3:=EMA(X2,4);

  50. STICKLINE(C>stopprice,LOW,HIGH,0.1,1),COLORRED;
  51. STICKLINE(C>stopprice,CLOSE,OPEN,3,1),COLORRED;
  52. STICKLINE(C<stopprice,LOW,HIGH,0.1,1),COLORFFFF52;
  53. STICKLINE(C<stopprice,CLOSE,OPEN,3,0),COLORFFFF52;



  54. BUY1:=(K>REF(K,1)&&D<REF(D,1)&&J>REF(J,1))&&C>stopprice&&time>0915&&time<=1510 and macd1>ref(macd1,1) and  holding<=0 ;
  55. SELL1:=(J<REF(J,1)&&K<REF(K,1)&&D>REF(D,1))&&C<stopprice&&time>0915&&time<=1510 and  macd1<ref(macd1,1) and holding>=0 ;

  56. VARIABLE:DUOKONG=0;
  57. TSFS:=0;
  58. ORDVOL:=1;     {开仓手数}
  59. ZSDS:=8;     

  60. VARIABLE:YDZY=1;  
  61. VARIABLE:HIGHPRICE=0,LOWPRICE=0;
  62. VARIABLE:DHCDS=5,KHCDS=5;
  63. VARIABLE:DYLDS=1,KYLDS=1;  
  64. VARIABLE:Z3B1:=1;  
  65. DUOKONG:=1;

  66. IF HOLDING<0 THEN BEGIN
  67. IF BUY1 THEN BEGIN   
  68.   空平:SELLSHORT(1,ORDVOL,THISCLOSE),ORDERQUEUE;
  69. END


  70. IF  a1 THEN BEGIN
  71.   空损:SELLSHORT(1,ORDVOL,THISCLOSE),ORDERQUEUE;
  72.    多1开:BUY(1=1,ORDVOL,THISCLOSE),ORDERQUEUE;
  73. END


  74. IF YDZY=1 THEN BEGIN

  75.   IF L<LOWPRICE THEN BEGIN
  76.    LOWPRICE:=L;
  77.   END
  78.   

  79.   IF ENTERPRICE-LOWPRICE>=KYLDS and c-ENTERPRICE<=-0.2 THEN BEGIN
  80.    IF L-LOWPRICE>=KHCDS THEN BEGIN  
  81.     空赢:SELLSHORT(1,ORDVOL,THISCLOSE),ORDERQUEUE;
  82.    END
  83.   END
  84. END


  85. IF Z3B1=1 THEN BEGIN
  86.   IF ENTERPRICE-LOWPRICE>=3 THEN BEGIN
  87.    IF ENTERPRICE-L<=1.2 THEN BEGIN

  88.    END
  89.   END
  90. END
  91. END

  92. IF HOLDING=0 THEN BEGIN
  93. IF DUOKONG=1 OR DUOKONG=2 THEN BEGIN
  94.   IF BUY1  and abb  THEN BEGIN
  95.    多开:BUY(1=1,ORDVOL,THISCLOSE),ORDERQUEUE;
  96.    HIGHPRICE:=ENTERPRICE;
  97.   END
  98. END
  99. END

  100. IF HOLDING>0 THEN BEGIN
  101. IF SELL1 THEN BEGIN  
  102.   多平:SELL(1,ORDVOL,THISCLOSE),ORDERQUEUE;;
  103. END


  104. IF a2 THEN BEGIN
  105.   多损:SELL(1,ORDVOL,THISCLOSE),ORDERQUEUE;
  106.      空1开:BUYSHORT(1=1,ORDVOL,THISCLOSE),ORDERQUEUE;
  107. END

  108. IF YDZY=1 THEN BEGIN

  109.   IF H>HIGHPRICE THEN BEGIN
  110.    HIGHPRICE:=H;
  111.   END


  112.   IF HIGHPRICE-ENTERPRICE>=DYLDS and c-ENTERPRICE>=0.2 THEN BEGIN
  113.    IF HIGHPRICE-H>=DHCDS THEN BEGIN  
  114.     多赢:SELL(1,ORDVOL,THISCLOSE),ORDERQUEUE;
  115.    END
  116.   END
  117. END

  118. IF Z3B1=1 THEN BEGIN
  119.   IF HIGHPRICE-ENTERPRICE>=3 THEN BEGIN
  120.    IF H-ENTERPRICE<=1.2 THEN BEGIN

  121.    END
  122.   END
  123. END
  124. END// www.cxh99.com

  125. IF HOLDING=0 THEN BEGIN
  126. IF DUOKONG=1 OR DUOKONG=3 THEN BEGIN
  127.   IF SELL1  and abb  THEN BEGIN
  128.    空开:BUYSHORT(1=1,ORDVOL,THISCLOSE),ORDERQUEUE;
  129.    LOWPRICE:=ENTERPRICE;
  130.   END
  131. END
  132. END // www.cxh99.com


  133.   IF time>=1513 THEN BEGIN
  134.   收盘平空:SELLSHORT(1,ORDVOL,THISCLOSE),ORDERQUEUE;
  135.   END // www.cxh99.com QQ511411198

  136.   IF time>=1513 THEN BEGIN
  137.   收盘平多:SELL(1,ORDVOL,THISCLOSE),ORDERQUEUE;
  138.   END
复制代码

论坛官方微信、群(期货热点、量化探讨、开户与绑定实盘)
 
期货论坛 - 版权/免责声明   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


卓越

TOP

返回列表