通达信老指标新用法:macd有狼心公式

[复制链接]
查看341 | 回复0 | 2022-7-24 09:04:27 | 显示全部楼层 |阅读模式

rsi趋势画线买入法目前已经优化完毕,跟帖的朋友不是很多,所以现在特别推出老指标新用法之macd有狼心。
其中的奥妙慢慢体会摸索吧,在此特别感谢论坛前辈们的指导与奉献。
欢乐铭记:喝水不忘打井人
源码如下:{牛牛指标网提供:www.tdx001.com}
 

复制内容到剪贴板
  1. {MACD有狼心}   
  2. DIF1:=EMA(CLOSE,12)-EMA(CLOSE,26),COLOR00FF00,LINETHICK1;   
  3. DEA1:=EMA(DIF1,9),COLOR00FF00,LINETHICK1;   
  4. DRAWICON(CROSS(DIF1,DEA1),DEA1,1);   
  5. DRAWICON(CROSS(DEA1,DIF1),DEA1,2);   
  6. {主升浪消失出局}   
  7. DI:=EMA(CLOSE,4)-EMA(CLOSE,13),COLORMAGENTA,LINETHICK2;   
  8. D1:=EMA(DI,5),COLORGRAY;   
  9. D2:=EMA(DI,10),COLORGRAY;   
  10. D3:=EMA(DI,20),COLORGRAY;   
  11. D4:=EMA(DI,30),COLORGRAY;   
  12. D5:=EMA(DI,60),COLORGRAY;   
  13. D6:=EMA(DI,90),COLORGRAY;   
  14. D7:=EMA(DI,120),COLORGRAY;   
  15. D8:=EMA(DI,250),COLORGRAY;   
  16. AA:=STICKLINE(DI>=REF(DI,1) AND D1>=REF(D1,1) AND D2>=REF(D2,1) AND D3>=REF(D3,1) AND    
  17. D4>=REF(D4,1) AND D5>=REF(D5,1) AND D6>=REF(D6,1) AND D7>=REF(D7,1) AND    
  18. D8>=REF(D8,1) AND C>EMA(C,11) AND DI>-0.8,DI,0,2,0),COLORRED;   
  19. STICKLINE(AA,DIF1,DEA1,3,0),COLORE6E8FA;   
  20. {柱状线}    
  21. MACD1:=(DIF1-DEA1)*2;   
  22. STICKLINE(MACD1>REF(MACD1,1),0,MACD1,3.2,0),COLOR0000FF;   
  23. STICKLINE(MACD1>REF(MACD1,1),0,MACD1,2.7,0),,COLOR0000FF;   
  24. STICKLINE(MACD1>REF(MACD1,1),0,MACD1,2.1,0),COLOR0000FF;   
  25. STICKLINE(MACD1>REF(MACD1,1),0,MACD1,1.5,0),COLOR0000FF;   
  26. STICKLINE(MACD1>REF(MACD1,1),0,MACD1,0.9,0),COLOR0000FF;   
  27. STICKLINE(MACD1>REF(MACD1,1),0,MACD1,0.3,0),COLORCC66FF;   
  28. STICKLINE(MACD1<REF(MACD1,1),0,MACD1,3.2,0),COLORFF9900;   
  29. STICKLINE(MACD1<REF(MACD1,1),0,MACD1,2.7,0),COLORFF9900;   
  30. STICKLINE(MACD1<REF(MACD1,1),0,MACD1,2.1,0),COLORFF9900;   
  31. STICKLINE(MACD1<REF(MACD1,1),0,MACD1,1.5,0),COLORFF9900;   
  32. STICKLINE(MACD1<REF(MACD1,1),0,MACD1,0.9,0),COLORFF9900;   
  33. STICKLINE(MACD1<REF(MACD1,1),0,MACD1,0.3,0),COLORFFCC00;   
  34. STICKLINE(MACD1>=0 OR MACD1<=0,0,0,50,1),COLORWHITE;   
  35. {买点提示}   
  36. A1:=BARSLAST(REF(CROSS(DIF1,DEA1),1));   
  37. BL:=REF(CLOSE,A1+1)>CLOSE AND DIF1>REF(DIF1,A1+1) AND CROSS(DIF1,DEA1);   
  38. {STICKLINE(BL,0,1,2,0),COLOR00FF00;}   
  39. DRAWICON(BL,DEA1,23);   
  40. A2:=BARSLAST(REF(CROSS(DEA1,DIF1),1));   
  41. DBL:=REF(CLOSE,A2+1)<CLOSE AND REF(DIF1,A2+1)>DIF1 AND CROSS(DEA1,DIF1);   
  42. DRAWICON(DBL,DEA1,12);    
  43. 低位金叉:=CROSS(DIF1,DEA1) AND DIF1<-0.1;   
  44. DRAWTEXT(低位金叉,DIF1,' 低位金叉');   
  45. JCCOUNT:=COUNT(CROSS(DIF1,DEA1),BARSLAST(DEA1>=0));   
  46. 二次金叉:=CROSS(DIF1,DEA1) AND DEA1<0 AND COUNT(JCCOUNT=2,21)=1;   
  47. DRAWICON(二次金叉,DEA1*1.04,13) ;   
  48. DRAWTEXT(二次金叉,-0.1,' 二次金叉'),COLORFF00FF;   
  49. A10:=BARSLAST(REF(CROSS(DIF1,DEA1),1));   
  50. 底背离:=REF(CLOSE,A10+1)>CLOSE AND DIF1>REF(DIF1,A10+1) AND CROSS(DIF1,DEA1);   
  51. DRAWLINE(A10=0,DEA1,底背离,DEA1,0),COLORRED,LINETHICK2;   
  52. DRAWTEXT(底背离,-0.50,' 底背离'),COLOR00FF00;   
  53. A20:=BARSLAST(REF(CROSS(DEA1,DIF1),1));   
  54. 顶背离:=REF(CLOSE,A20+1)<CLOSE AND REF(DIF1,A20+1)>DIF1 AND CROSS(DEA1,DIF1);   
  55. DRAWLINE(A20=0,DEA1,顶背离,DEA1,0),COLORWHITE,LINETHICK2;   
  56. {趋势柱状线}   
  57. WY1001:=(2*CLOSE+HIGH+LOW)/4;    
  58. WY1002:=EMA(WY1001,4);    
  59. WY1003:=EMA(WY1002,4);    
  60. WY1004:=EMA(WY1003,4);    
  61. X:=(WY1004-REF(WY1004,1))/REF(WY1004,1)*100;    
  62. X1:=IF(X<REF(X,1),X,DRAWNULL),COLORWHITE,LINETHICK2;   
  63. XO:=MA(X,2),COLOR9932CD;   
  64. SI:=REF(X,1);   
  65. STICKLINE(X>SI,X,SI,2.3,0),COLOR0000FF;   
  66. STICKLINE(X>SI,X,SI,0.3,0),COLORCC66FF;   
  67. STICKLINE(X<SI,X,SI,2.3,0),COLOR00BB00;   
  68. STICKLINE(X<SI,X,SI,0.3,0),COLOR00FF00;   
  69. STICKLINE(底背离,X,SI,1,0),COLORYELLOW;   
  70. STICKLINE(低位金叉,X,SI,1,0),COLORWHITE;    
  71. STICKLINE(低位金叉 AND 底背离,X,SI,0.1,0),COLORYELLOW;    
  72. {买点2,可省}   
  73. VAR2:=REF(LOW,1);   
  74. VAR3:=SMA(ABS(LOW-VAR2),3,1)/SMA(MAX(LOW-VAR2,0),3,1)*100;   
  75. VAR4:=EMA(IF(CLOSE*1.3,VAR3*10,VAR3/10),3);   
  76. VAR5:=LLV(LOW,13);   
  77. VAR6:=HHV(VAR4,13);   
  78. VAR7:=IF(MA(CLOSE,34),1,0);   
  79. VAR8:=EMA(IF(LOW<=VAR5,(VAR4+VAR6*2)/2,0),3)/618*VAR7;   
  80. VAR9:=IF(VAR8>100,100,VAR8);   
  81. VAR10:=IF(VAR9>-120,VAR9,0);   
  82. VAR11:=VAR10<REF(VAR10,1);   
  83. DRAWTEXT(VAR11 AND REF(NOT(VAR11),1),0,'☆'),COLORYELLOW;   
  84. {走势线}   
  85. DIF:DIF1,LINETHICK1,COLORGREEN;   
  86. DEA:DEA1,LINETHICK1,COLORGREEN;   
  87. DIF2:IF(MACD>REF(MACD,1),DIF1,DRAWNULL),COLORRED,LINETHICK1;   
  88. DEA2:IF(DEA1<DIF1,DEA1,DRAWNULL),COLORFF00FF,LINETHICK1;   
  89. {主力进场}   
  90. VAR12:=REF((LOW+OPEN+CLOSE+HIGH)/4,1);    
  91. VAR13:=SMA(ABS(LOW-VAR12),13,1)/SMA(MAX(LOW-VAR12,0),10,1);    
  92. VAR14:=EMA(VAR13,10);   
  93. VAR15:=LLV(LOW,33);   
  94. VAR16:=EMA(IF(LOW<=VAR15,VAR14,0),3);   
  95. 主力进场:=IF(VAR16>REF(VAR16,1),VAR16,0),COLORRED,NODRAW;   
  96. STICKLINE(主力进场,X,SI,0.1,0),COLORRED;   

5E74133476.jpg

5E74133476.jpg

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则