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

自用的MACD/KDJ/RSI/DMI顶底背离[大智慧公式]

自用的MACD/KDJ/RSI/DMI顶底背离[大智慧公式]

大智慧测试通过
  1. 底:-50;
  2. 顶:50;
  3. TR := SUM(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(LOW-REF(CLOSE,1))),14);
  4. HD := HIGH-REF(HIGH,1);
  5. LD := REF(LOW,1)-LOW;
  6. PDM:= SUM(IF(HD>0 AND HD>LD,HD,0),14);
  7. MDM:= SUM(IF(LD>0 AND LD>HD,LD,0),14);
  8. PDI:= PDM*100/TR;
  9. MDI:= MDM*100/TR;
  10. A1:=BARSLAST(ref(cross("macd.diff"(12,26,9),"macd.dea"(12,26,9)),1));
  11. B1:=ref(c,A1+1)>c and ref("macd.diff"(12,26,9),A1+1)<"macd.diff"(12,26,9) and cross("macd.diff"(12,26,9),"macd.dea"(12,26,9));
  12. A2:=BARSLAST(ref(cross("kdj.k"(9,3,3),"kdj.d"(9,3,3)),1));
  13. B2:=ref(c,A2+1)>c and ref("kdj.k"(9,3,3),A2+1)<"kdj.k"(9,3,3) and cross("kdj.k"(9,3,3),"kdj.d"(9,3,3));
  14. A3:=BARSLAST(ref(cross("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24)),1));
  15. B3:=ref(c,A3+1)>c and ref("RSI.RSI1"(6,12,24),A3+1)<"RSI.RSI1"(6,12,24) and cross("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24));
  16. C1:=BARSLAST(ref(cross("macd.dea"(12,26,9),"macd.diff"(12,26,9)),1));
  17. D1:=ref(c,C1+1)<c and ref("macd.diff"(12,26,9),C1+1)>"macd.diff"(12,26,9) and cross("macd.dea"(12,26,9),"macd.diff"(12,26,9));
  18. C2:=BARSLAST(ref(cross("kdj.d"(9,3,3),"kdj.k"(9,3,3)),1));
  19. D2:=ref(c,C2+1)<c and ref("kdj.k"(9,3,3),C2+1)>"kdj.k"(9,3,3) and cross("kdj.d"(9,3,3),"kdj.k"(9,3,3));
  20. C3:=BARSLAST(ref(cross("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24)),1));
  21. D3:=ref(c,C3+1)<c and ref("RSI.RSI1"(6,12,24),C3+1)>"RSI.RSI1"(6,12,24) and cross("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24));
  22. C4:=BARSLAST(ref(cross(mdi,pdi),1));
  23. D4:=ref(c,C+1)<c and ref(mdi,C4+1)>mdi and cross(mdi,pdi);
  24. A4:=BARSLAST(ref(cross(PDI,MDI),1));
  25. B4:=ref(c,A4+1)>c and ref(pdi,A4+1)<pdi and cross(pdi,mdi);
  26. DMI底背:IF(B4>0,-50,0),COLOR0099FF,POINTDOT;
  27. DRAWTEXT(DMI底背,-5,'DMI底背'),color0099FF;
  28. DMI顶背:IF(D4>0,50,0),COLORBLUE,POINTDOT;
  29. DRAWTEXT(DMI顶背,15,'DMI顶背'),COLORBLUE;
  30. MACD底背:if(B1>0,-50,0),colorred,pointdot;
  31. DRAWTEXT(MACD底背,-15,'MACD底背'),COLORred;
  32. KDJ底背:if(B2>0,-50,0),colorff00ff,pointdot;
  33. DRAWTEXT(KDJ底背,-25,'KDJ底背'),COLORff00ff;
  34. RSI底背:if(B3>0,-50,0),coloryellow,pointdot;
  35. DRAWTEXT(RSI底背,-35,'RSI底背'),COLORyellow;
  36. MACD顶背:if(D1>0,50,0),color00ff00,pointdot;
  37. DRAWTEXT(MACD顶背,25,'MACD顶背'),COLOR00ff00;
  38. KDJ顶背:if(D2>0,50,0),colorffcc66,pointdot;
  39. DRAWTEXT(KDJ顶背,35,'KDJ顶背'),COLORffcc66;
  40. RSI顶背:if(D3>0,50,0),colorffffff,pointdot;
  41. DRAWTEXT(RSI顶背,45,'RSI顶背'),COLORffffff;
  42. STICKLINE(B1>0,-50,0,2,0),colorred;
  43. STICKLINE(B2>0,-50,0,2,0),colorff00ff;
  44. STICKLINE(B3>0,-50,0,2,0),coloryellow;
  45. STICKLINE(d1>0,50,0,2,0),color00ff00;
  46. STICKLINE(d2>0,50,0,2,0),colorffcc66;
  47. STICKLINE(d3>0,50,0,2,0),colorwhite;
  48. STICKLINE(B4>0,-50,0,2,0),color0099ff;
复制代码


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

返回列表