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

[文华源码] MACD背离模型

[文华源码] MACD背离模型

本帖隐藏的内容需要回复才可以浏览

cxh-2.gif


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

通达信源码:
  1. DIFF:EMA(CLOSE,12)-EMA(CLOSE,27);
  2. DEA:EMA(DIFF,9);
  3. MACD:=2*(DIFF-DEA);
  4. STICKLINE(MACD>=0,MACD,0,2,1),COLORF00FF0;
  5. STICKLINE(MACD<0,MACD,0,2,1),COLORWHITE;
  6. STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR00AAFF;
  7. STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR00BBFF;
  8. STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR00CCFF;
  9. STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR00DDFF;
  10. STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR00EEFF;
  11. STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR00FFFF;
  12. STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR0000AA;
  13. STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR0011BB;
  14. STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR0022CC;
  15. STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR0033DD;
  16. STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR0044EE;
  17. STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR0055FF;
  18. STICKLINE(MACD>REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLORAA00BB;
  19. STICKLINE(MACD>REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLORBB11BB;
  20. STICKLINE(MACD>REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLORCC22BB;
  21. STICKLINE(MACD>REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLORDD33BB;
  22. STICKLINE(MACD>REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLOREE44BB;
  23. STICKLINE(MACD>REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLORFF55BB;
  24. STICKLINE(MACD<=REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLORFFAA00;
  25. STICKLINE(MACD<=REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLORFFBB11;
  26. STICKLINE(MACD<=REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLORFFCC22;
  27. STICKLINE(MACD<=REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLORFFDD33;
  28. STICKLINE(MACD<=REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLORFFEE44;
  29. STICKLINE(MACD<=REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLORFFFF55;
  30. IF(DIFF<0,DIFF,0),COLORRED,LINETHICK1;
  31. IF(DIFF<0,0,DIFF),COLORYELLOW,LINETHICK1;
  32. IF(DIFF<DEA,DIFF,DEA),COLOR00FF00,LINETHICK1;
  33. IF(DIFF>DEA,DEA,DEA),COLORWHITE,LINETHICK1;
  34. 低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.1;
  35. STICKLINE(低位金叉,0,-0.18,2,0),COLORYELLOW;
  36. DRAWTEXT(低位金叉,-0.1,' 低位金叉'),COLORYELLOW;
  37. JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
  38. 二次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;
  39. STICKLINE(二次金叉,0,-0.18,2,0),COLORFF00FF;
  40. DRAWICON(二次金叉,DEA*1.04,13) ;
  41. DRAWTEXT(二次金叉,-0.1,' 二次金叉'),COLORFF00FF;
  42. A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
  43. 底背离:=REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
  44. STICKLINE(底背离,0,0.13,2,0),COLOR00FF00;
  45. DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED,LINETHICK2;
  46. DRAWTEXT(底背离,0.1,' 底背离'),COLOR00FF00;
  47. A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
  48. 顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIFF,A2+1)>DIFF AND CROSS(DEA,DIFF);
  49. DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,LINETHICK2;
复制代码
如何访问权限为100/255贴子:/thread-37840-1-1.html;注册后仍无法回复:/thread-23-1-1.html;微信/QQ群:/thread-262-1-1.html;网盘链接失效解决办法:/thread-93307-1-1.html

TOP

优化后的MACD背离形态,注意这里是通达信软件上面的指标,不是程序化交易:
  1. DIFF:EMA(CLOSE,12)-EMA(CLOSE,27);
  2. DEA:EMA(DIFF,9);
  3. MACD:=2*(DIFF-DEA);
  4. STICKLINE(MACD>=0,MACD,0,2,1),COLORF00FF0;
  5. STICKLINE(MACD<0,MACD,0,2,1),COLORWHITE;
  6. STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR00AAFF;
  7. STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR00BBFF;
  8. STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR00CCFF;
  9. STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR00DDFF;
  10. STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR00EEFF;
  11. STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR00FFFF;
  12. STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR0000AA;
  13. STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR0011BB;
  14. STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR0022CC;
  15. STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR0033DD;
  16. STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR0044EE;
  17. STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,2,0 ),COLOR0055FF;
  18. STICKLINE(MACD>REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLORAA00BB;
  19. STICKLINE(MACD>REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLORBB11BB;
  20. STICKLINE(MACD>REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLORCC22BB;
  21. STICKLINE(MACD>REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLORDD33BB;
  22. STICKLINE(MACD>REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLOREE44BB;
  23. STICKLINE(MACD>REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLORFF55BB;
  24. STICKLINE(MACD<=REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLORFFAA00;
  25. STICKLINE(MACD<=REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLORFFBB11;
  26. STICKLINE(MACD<=REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLORFFCC22;
  27. STICKLINE(MACD<=REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLORFFDD33;
  28. STICKLINE(MACD<=REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLORFFEE44;
  29. STICKLINE(MACD<=REF(MACD,1)AND MACD<0,0,MACD,2,0 ),COLORFFFF55;
  30. A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
  31. 底背离:=REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
  32. STICKLINE(底背离,0,0.13,2,0),COLOR00FF00;
  33. DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED,LINETHICK2;
  34. DRAWTEXT(底背离,0.5*DEA,' 底背离'),COLOR00FF00;
  35. A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
  36. 顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIFF,A2+1)>DIFF AND CROSS(DEA,DIFF);
  37. STICKLINE(顶背离,0,0.13,2,0),COLOR00FF00;
  38. DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,LINETHICK2;
  39. DRAWTEXT(顶背离,0.5*DEA,'顶背离'),COLOR00FF00;
复制代码
如何访问权限为100/255贴子:/thread-37840-1-1.html;注册后仍无法回复:/thread-23-1-1.html;微信/QQ群:/thread-262-1-1.html;网盘链接失效解决办法:/thread-93307-1-1.html

TOP

博易大师上面的源码:
  1. DIFF:EMA(CLOSE,12)- EMA(CLOSE,27);
  2. DEA:EMA(DIFF,9);
  3. MACD:= 2*(DIFF-DEA);
  4. STICKLINE(MACD>=0,MACD,0,2,1),COLORF00FF0;
  5. STICKLINE(MACD<0,MACD,0,2,1),COLORWHITE;
  6. STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,5,0 ),COLOR00AAFF;
  7. STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,5,0 ),COLOR00BBFF;
  8. STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,5,0 ),COLOR0000AA;
  9. STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,5,0 ),COLOR0011BB;
  10. STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,5,0 ),COLORAA00BB;
  11. STICKLINE(MACD<=REF(MACD,1)AND MACD<0,0,MACD,5,0 ),COLORFFAA00;
  12. A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
  13. 底背离:=REF(CLOSE,A1+1) > CLOSE AND REF(DIFF,A1+1) < DIFF AND CROSS(DIFF,DEA);
  14. STICKLINE(底背离,0,13,2,0),COLOR00FF00;
  15. DRAWTEXT(底背离,DEA+20,' 底背离'),COLOR00FF00;
  16. A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
  17. 顶背离:=REF(CLOSE,A2+1) < CLOSE AND REF(DIFF,A2+1) > DIFF AND CROSS(DEA,DIFF);
  18. STICKLINE(顶背离,0,-13,2,0),COLOR00FF00;
  19. DRAWTEXT(顶背离,DEA-20,' 顶背离'),COLOR00FF00;
复制代码



这里面有一个问题,就是画线的问题,博易大师上面能找到两个金叉的位置同时提醒说是顶背离或底背离了,但是不能在两个金叉或死叉之间画线。这个通达信功能上面是有的,所以我感觉博易大师是史移植了通达信的部分功能,再就是跟周期功能博易大师也实现不了,总之博易大师你就只能当做一个看行情的软件好了,别想多了就好。
如何访问权限为100/255贴子:/thread-37840-1-1.html;注册后仍无法回复:/thread-23-1-1.html;微信/QQ群:/thread-262-1-1.html;网盘链接失效解决办法:/thread-93307-1-1.html

TOP

文华财经:
  1. DIFF:EMA(CLOSE,12)-EMA(CLOSE,27);
  2. DEA:EMA(DIFF,9);
  3. MACD:=2*(DIFF-DEA);
  4. STICKLINE(MACD>=0,MACD,0,2,1),COLORF00FF0;
  5. STICKLINE(MACD<0,MACD,0,2,1),COLORWHITE;
  6. STICKLINE(MACD<REF(MACD,1) AND MACD>0,0,MACD,2,0 ),COLOR00AAFF;
  7. STICKLINE(MACD<REF(MACD,1) AND MACD>0,0,MACD,2,0 ),COLOR00BBFF;
  8. STICKLINE(MACD<REF(MACD,1) AND MACD>0,0,MACD,2,0 ),COLOR00CCFF;
  9. STICKLINE(MACD<REF(MACD,1) AND MACD>0,0,MACD,2,0 ),COLOR00DDFF;
  10. STICKLINE(MACD<REF(MACD,1) AND MACD>0,0,MACD,2,0 ),COLOR00EEFF;
  11. STICKLINE(MACD<REF(MACD,1) AND MACD>0,0,MACD,2,0 ),COLOR00FFFF;
  12. STICKLINE(MACD>=REF(MACD,1) AND MACD>0,0,MACD,2,0 ),COLOR0000AA;
  13. STICKLINE(MACD>=REF(MACD,1) AND MACD>0,0,MACD,2,0 ),COLOR0011BB;
  14. STICKLINE(MACD>=REF(MACD,1) AND MACD>0,0,MACD,2,0 ),COLOR0022CC;
  15. STICKLINE(MACD>=REF(MACD,1) AND MACD>0,0,MACD,2,0 ),COLOR0033DD;
  16. STICKLINE(MACD>=REF(MACD,1) AND MACD>0,0,MACD,2,0 ),COLOR0044EE;
  17. STICKLINE(MACD>=REF(MACD,1) AND MACD>0,0,MACD,2,0 ),COLOR0055FF;
  18. STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,2,0 ),COLORAA00BB;
  19. STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,2,0 ),COLORBB11BB;
  20. STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,2,0 ),COLORCC22BB;
  21. STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,2,0 ),COLORDD33BB;
  22. STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,2,0 ),COLOREE44BB;
  23. STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,2,0 ),COLORFF55BB;
  24. STICKLINE(MACD<=REF(MACD,1) AND MACD<0,0,MACD,2,0 ),COLORFFAA00;
  25. STICKLINE(MACD<=REF(MACD,1) AND MACD<0,0,MACD,2,0 ),COLORFFBB11;
  26. STICKLINE(MACD<=REF(MACD,1) AND MACD<0,0,MACD,2,0 ),COLORFFCC22;
  27. STICKLINE(MACD<=REF(MACD,1) AND MACD<0,0,MACD,2,0 ),COLORFFDD33;
  28. STICKLINE(MACD<=REF(MACD,1) AND MACD<0,0,MACD,2,0 ),COLORFFEE44;
  29. STICKLINE(MACD<=REF(MACD,1) AND MACD<0,0,MACD,2,0 ),COLORFFFF55;
  30. A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
  31. 底背离:=REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
  32. STICKLINE(底背离,0,0.5*DEA,2,1),COLORRED;
  33. DRAWTEXT(底背离,0.5*DIFF,' 底背离'),COLORRED;
  34. A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
  35. 顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIFF,A2+1)>DIFF AND CROSS(DEA,DIFF);
  36. STICKLINE(顶背离,0,0.5*DEA,2,1),COLORGREEN;
  37. DRAWTEXT(顶背离,0.5*DEA,'顶背离'),COLORGREEN;

  38. //上面是MACD背离源码

  39. //下面是MACD共振源码
复制代码
如何访问权限为100/255贴子:/thread-37840-1-1.html;注册后仍无法回复:/thread-23-1-1.html;微信/QQ群:/thread-262-1-1.html;网盘链接失效解决办法:/thread-93307-1-1.html

TOP

如何访问权限为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

dddd

TOP

学学

TOP

我wwwwwwwwwwwwwww

TOP

返回列表