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

[通达信指标/源码] 鳄鱼法则交易策略(鳄鱼线、AO、AC指标公式源码)[通达信源码]

[通达信指标/源码] 鳄鱼法则交易策略(鳄鱼线、AO、AC指标公式源码)[通达信源码]

策略说明:鳄鱼线交易法则策略为鳄鱼线为均线类,所以在主图上。AO AC以及最后面的视窗为副图。设置指标公式源码时注意一下。鳄鱼线法则这个策略需要四个图的,一个主技术图,3个指标图,我在最后有一个示例效果图。


鳄鱼-线源码:
  1. Y:=(H+L)/2;
  2. AA:=REF((SMA(Y,5,1)),3);
  3. BB:=REF((SMA(Y,8,1)),5);
  4. CC:=REF((SMA(Y,13,1)),8);
  5. 鳄:CC,COLORFF6600;
  6. 齿:BB,COLORRED;
  7. 唇:AA,COLORGREEN;
  8. R2:=REF(齿,5);
  9. KU1:=IF(HIGH=HHV(HIGH,3),1,0);
  10. KD1:=IF(LOW=LLV(LOW,3),1,0);
  11. UL:=IF(REF(KU1,2)=1 AND REF(KU1,1)=0 AND KU1=0,REF(HIGH,2),REF(HIGH,2+BARSLAST(REF(KU1,2)=1 AND REF(KU1,1)=0 AND KU1=0)));
  12. DL:=IF(REF(KD1,2)=1 AND REF(KD1,1)=0 AND KD1=0,REF(LOW,2),REF(LOW,2+BARSLAST(REF(KD1,2)=1 AND REF(KD1,1)=0 AND KD1=0)));
  13. 上分形:IF(HIGH>=R2,UL,REF(UL,BARSLAST(HIGH>R2))),POINTDOT,LINETHICK3,,COLORMAGENTA;
  14. 下分形:IF(LOW<=R2,DL,REF(DL,BARSLAST(LOW<=R2))),POINTDOT,LINETHICK3,COLORYELLOW;
  15. DRAWICON(CLOSE>上分形 AND REF(CLOSE,1)<REF(上分形,1),HIGH*1.03,1);
  16. DRAWICON(CLOSE<下分形 AND REF(CLOSE,1)>REF(下分形,1),LOW*0.99,2);
  17. AO:=MA(Y,5)-MA(Y,34);
  18. MAO:=MA(AO,5);
  19. AC:=AO-MAO;
  20. AC1:=REF(AC,1);
  21. AO1:=REF(AO,1);
  22. KAC:=IF(AC>AC1 AND AO>AO1,1,0);
  23. KAO:=IF(AC<AC1 AND AO<AO1,-1,0);
  24. STICKLINE(KAC=1 AND CLOSE>=OPEN,OPEN,CLOSE,3,1),COLORRED;
  25. STICKLINE(KAO=-1 AND CLOSE>=OPEN,OPEN,CLOSE,3,1),COLORGREEN;
  26. STICKLINE(KAO=0 AND KAC=0 AND CLOSE>=OPEN,OPEN,CLOSE,3,1),COLORDDDDDD;
  27. STICKLINE(CLOSE>=OPEN,HIGH,CLOSE,0.0.1,0),COLORRED;
  28. STICKLINE(CLOSE>=OPEN,OPEN,LOW,0.0.1,0),COLORRED;
  29. STICKLINE(KAC=1 AND CLOSE<OPEN,OPEN,CLOSE,3,0),COLORRED;
  30. STICKLINE(KAO=-1 AND CLOSE<OPEN,OPEN,CLOSE,3,0),COLORGREEN;
  31. STICKLINE(KAO=0 AND KAC=0 AND CLOSE<OPEN,OPEN,CLOSE,3,0),COLORDDDDDD;
复制代码



AO动量源码:

  1. VAR1:=(HIGH+LOW)/2;
  2. AO:MA(VAR1,5)-MA(VAR1,34),LINETHICK0;
  3. STICKLINE(AO>=REF(AO,1),0,AO,2.2,1),COLORRED;
  4. STICKLINE(AO<REF(AO,1),0,AO,2.2,1),COLORGREEN;
  5. AO5:MA(AO,5),COLORFF6600;
  6. S1:=CROSS(0,AO);
  7. DRAWTEXT(S1,AO,'S'),COLORWHITE;
  8. DRAWICON(S1,AO,2);
  9. S2:=AO<0 AND REF(AO,1)>REF(AO,2) AND AO<REF(AO,1);
  10. DRAWTEXT(S2,AO,'S'),COLORWHITE;
  11. DRAWICON(S2,AO,2);
  12. SCOUNT:=BARSLAST(AO<0);
  13. SD:=HHV(AO,SCOUNT);
  14. SCOUNTD:=HHVBARS(AO,SCOUNT);
  15. S3:=AO>0 AND REF(AO,1)>REF(AO,2) AND AO<REF(AO,1);
  16. S31:=COUNT(S3,SCOUNTD);
  17. DRAWTEXT(S31>=2 AND S3,AO,'S'),COLORWHITE;
  18. DRAWICON(S31>=2 AND S3,AO,2);
  19. B1:=CROSS(AO,0);
  20. DRAWTEXT(B1,AO,'B'),COLORWHITE;
  21. DRAWICON(B1,AO,1);
  22. B2:=AO>0 AND REF(AO,1)<REF(AO,2) AND AO>REF(AO,1) ;
  23. DRAWTEXT(B2,AO,'B'),COLORWHITE;
  24. DRAWICON(B2,AO,1);
  25. BCOUNT:=BARSLAST(AO>0);
  26. BD:=LLV(AO,BCOUNT);
  27. BCOUNTD:=LLVBARS(AO,BCOUNT);
  28. B3:=AO<0 AND REF(AO,1)<REF(AO,2) AND AO>REF(AO,1);
  29. B31:=COUNT(B3,BCOUNTD);
  30. DRAWTEXT(B31>=2 AND B3,AO,'B'),COLORWHITE;
  31. DRAWICON(B31>=2 AND B3,AO,1);
复制代码



AC加速源码:

  1. AO:=MA((HIGH+LOW)/2,5)-MA((HIGH+LOW)/2,34);
  2. AO5:=MA(AO,5);
  3. AC:AO-AO5,LINETHICK0;
  4. STICKLINE(AC>=REF(AC,1),0,AC,2.2,1),COLORRED;
  5. STICKLINE(AC< REF(AC,1),0,AC,2.2,1),COLORGREEN;
  6. AC1:=REF(AC,1);
  7. BUY1:=REF(AC,3)<REF(AC1,3) AND REF(AC,2)<REF(AC1,2) AND REF(AC,2)<REF(AC,3) AND REF(AC,1)>REF(AC1,1) AND AC>AC1 AND COUNT(AC>0,4)=4;
  8. DRAWTEXT(BUY1,AC,'B'),COLORWHITE;
  9. DRAWICON(BUY1,AC,1);
  10. BUY2:=COUNT(AC<0,4)=4 AND REF(AC,3)<REF(AC1,3) AND COUNT(AC>AC1,3)=3;
  11. DRAWTEXT(BUY2,AC, 'B'),COLORWHITE;
  12. DRAWICON(BUY2,AC,1);
  13. BUY3:=REF(AC,3)<REF(AC1,3) AND REF(AC,2)<REF(AC1,2) AND REF(AC,2)<REF(AC,3) AND COUNT(AC>AC1,2)=2 AND REF(AC,1)<0 AND AC>0;
  14. DRAWTEXT(BUY3,AC, 'B'),COLORWHITE;
  15. DRAWICON(BUY3,AC,1);
  16. BUY4:=REF(AC,4)<REF(AC1,4) AND REF(AC,3)<REF(AC1,3) AND REF(AC,3)<REF(AC,4) AND COUNT(AC>AC1,3)=3 AND REF(AC,1)<0 AND AC>0;
  17. DRAWTEXT(BUY4,AC, 'B'),COLORWHITE;
  18. DRAWICON(BUY4,AC,1);
  19. S1:=REF(AC,3)>REF(AC1,3) AND REF(AC,2)>REF(AC1,2) AND REF(AC,2)>REF(AC,3) AND REF(AC,1)<REF(AC1,1) AND AC<AC1 AND COUNT(AC<0,4)=4;
  20. DRAWTEXT(S1,AC,'S'),COLORWHITE;
  21. DRAWICON(S1,AC,2);
  22. S2:=COUNT(AC>0,4)=4 AND REF(AC,3)>REF(AC1,3) AND COUNT(AC<AC1,3)=3;
  23. DRAWTEXT(S2,AC,'S'),COLORWHITE;
  24. DRAWICON(S2,AC,2);
  25. S3:=REF(AC,3)>REF(AC1,3) AND REF(AC,2)>REF(AC1,2) AND REF(AC,2)>REF(AC,3) AND COUNT(AC<AC1,2)=2 AND REF(AC,1)>0 AND AC<0;
  26. DRAWICON(S3,AC,2);
复制代码



MFI视窗源码:

  1. MFI:(H-L)*1000000/V,STICK;
  2. A1:=MFI>=REF(MFI,1)*1.1 AND V>=REF(V,1)*1.1;
  3. A2:=MFI<=REF(MFI,1)*0.9 AND V<=REF(V,1)*0.9;
  4. A3:=MFI>=REF(MFI,1)*1.1 AND V<=REF(V,1)*0.9;
  5. A4:=MFI<=REF(MFI,1)*0.9 AND V>=REF(V,1)*1.1;  
  6. STICKLINE(A1,0,MFI,0.1,1),COLORGREEN;
  7. STICKLINE(A2,0,MFI,0.1,1),COLORBLUE;
  8. STICKLINE(A3,0,MFI,0.1,1),COLORBROWN;
  9. STICKLINE(A4,0,MFI,0.1,1),COLORMAGENTA;
  10. MA5:MA(MFI,5);
  11. 绿灯:IF(A1,MFI,DRAWNULL),STICK,COLORGREEN;
  12. 衰退:IF(A2,MFI,DRAWNULL),STICK,COLORBLUE;
  13. 伪装:IF(A3,MFI,DRAWNULL),STICK,COLORBROWN;
  14. 蛰伏:IF(A4,MFI,DRAWNULL),STICK,COLORMAGENTA;
复制代码



效果图如下:

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

看看

TOP

学习

TOP

学习了

TOP

返回列表