分时T+0集成MACD和KDJ(通达信公式 分时主图 源码 测试图)
{高点直线} V1:=TIME;T:=IF(V1<130000,(FLOOR(V1/10000)-9.5)*60+(FLOOR(V1/100)-100*FLOOR(V1/10000)),(FLOOR(V1/10000)-11)*60+(FLOOR(V1/100)-100*FLOOR(V1/10000))),NODRAW;KP30:=T<240;KPGD:=H=HHV(H,0) AND KP30;GDSJ:=BARSLAST(KPGD);HHHH:REF(H,GDSJ),COLORFFFF00,DOTLINE;{低点直线} VQ1:=TIME;TQ:=IF(VQ1<130000,(FLOOR(V1/10000)-9.5)*60+(FLOOR(VQ1/100)-100*FLOOR(VQ1/10000)),(FLOOR(VQ1/10000)-11)*60+(FLOOR(VQ1/100)-100*FLOOR(VQ1/10000))),NODRAW;KPQ30:=TQ<240;KPGDQ:=L=LLV(L,0) AND KPQ30;GDSJQ:=BARSLAST(KPGDQ);HHHHQ:REF(L,GDSJQ),COLOR80FF00,DOTLINE;DRAWTEXT_FIX(1 AND FROMOPEN<=120,0.5,0,0,DYBLOCK),COLORFFFFFF;DRAWTEXT_FIX(1 AND FROMOPEN<=120,0.6,0,0,GNBLOCK),COLOR00FFFF;DRAWTEXT_FIX(1 AND FROMOPEN<=120,0.7,0,0,FGBLOCK),COLOR0080FF;DRAWTEXT_FIX(1 AND FROMOPEN>120,0.0,0,0,DYBLOCK),COLORFFFFFF;DRAWTEXT_FIX(1 AND FROMOPEN>120,0.1,0,0,GNBLOCK),COLORFF8000;DRAWTEXT_FIX(1 AND FROMOPEN>120,0.5,0,0,FGBLOCK),COLOR0080FF;股东人数:=FINANCE(8);DRAWNUMBER_FIX(1 AND FROMOPEN<=120,0.88,1,0,股东人数),COLOR00FFFF;DRAWTEXT_FIX(1 AND FROMOPEN<=120,0.975,1,0,'人'),COLORFFFFFF;DRAWNUMBER_FIX(1 AND FROMOPEN>120,0.4,1,0,股东人数),COLOR00FFFF;DRAWTEXT_FIX(1 AND FROMOPEN>120,0.48,1,0,'户'),COLORFFFFFF;AAA1:=STRCAT('总上涨:',CON2STR(DYNAINFO(60),0)); AAA2:=STRCAT('总下跌:',CON2STR(DYNAINFO(61),0));DRAWTEXT_FIX(1 AND FROMOPEN<=120,0.5,0.85,0,AAA1),COLOR00FFFF;DRAWTEXT_FIX(1 AND FROMOPEN<=120,0.5,1,0,AAA2),COLORFFFF80;DRAWTEXT_FIX(1 AND FROMOPEN>120,0.2,0.85,0,AAA1),COLOR00FFFF;DRAWTEXT_FIX(1 AND FROMOPEN>120,0.2,1,0,AAA2),COLORFFFF80;{分时MACD}FF:=(C-REF(C,N))/REF(C,N);STICKLINE(FF>0,DYNAINFO(3),DYNAINFO(3)*(1+FF),0.5,0),COLORRED;
STICKLINE(FF<0,DYNAINFO(3),DYNAINFO(3)*(1+FF),0.5,0),COLORGREEN;
A1:=BARSLAST(REF(CROSS("MACD.DIF"(12,26,9),"MACD.DEA"(12,26,9)),1));B1:=REF(C,A1+1)>C AND REF("MACD.DIF"(12,26,9),A1+1)<"MACD.DIF"(12,26,9) AND CROSS("MACD.DIF"(12,26,9),"MACD.DEA"(12,26,9));底背离MACD:DRAWTEXT(FILTER(B1>0,5),HIGH*0.9988,'↖'),COLOR80FFFF;DRAWTEXT(FILTER(B1>0,5),LOW*0.997,'MACD底'),COLORFF53FF;A2:=BARSLAST(REF(CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3)),1));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));底背离KDJ:DRAWTEXT(FILTER(B2>0,5),HIGH*0.9988,'↖'),COLOR80FFFF;DRAWTEXT(FILTER(B2>0,5),LOW*0.997,'KDJ底'),COLORFF53FF;C1:=BARSLAST(REF(CROSS("MACD.DEA"(12,26,9),"MACD.DIF"(12,26,9)),1));D1:=REF(C,C1+1)<C AND REF("MACD.DIF"(12,26,9),C1+1)>"MACD.DIF"(12,26,9) AND CROSS("MACD.DEA"(12,26,9),"MACD.DIF"(12,26,9));顶背离MACD:DRAWTEXT(FILTER(D1>0,5),HIGH*1.0008,'↙'),COLOR00FF00;DRAWTEXT(FILTER(D1>0,5),HIGH*1.004,'MACD顶'),COLORFFFF00;C2:=BARSLAST(REF(CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3)),1));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));顶背离KDJ:DRAWTEXT(FILTER(D2>0,5),HIGH*1.0008,'↙'),COLOR00FF00;
DRAWTEXT(FILTER(D2>0,5),HIGH*1.004,'KDJ顶'),COLORFFFF00;
为你点赞 沙发!沙发! 好贴不能沉! 爱分享,爱生活 感谢感谢!楼主功德无量,哈哈!
页:
[1]