斋主精品MACD副图源码
W:=1;
M:=1;
MM:=9*M;
SHORT:=MM*4/3;
LONG:=MM*26/9;
DIFF:=(EMA(CLOSE,SHORT)-EMA(CLOSE,LONG));
DEA:=EMA(DIFF,MM),COLOR58FF58;
MACD:=2*(DIFF-DEA),COLORFFFF00,LINETHICK0;
红柱:DRAWBAND(MACD,RGB(180,50,50),0,RGB(0,128,0));
绿柱:DRAWBAND(0,RGB(0,128,0),MACD,RGB(180,50,50));
A00:=SUM(IF((CLOSE > REF(CLOSE, 1.000)),VOL,IF((CLOSE < REF(CLOSE, 1.000)),(0 - VOL),0)),0);
A01:=SUMBARS(VOL,CAPITAL);
A02:=IF((CLOSE > LLV(CLOSE,A01)), 1.000,(0 - 1.000)) * IF((A00 > LLV(A00,A01)), 1.000,(0 - 1.000));
A03:=(COUNT((IF((A02 = (0 - 1.000)), 1.000,0) = 1.000), 8.000) > 2.000);
A04:=((CLOSE - DMA(((( 3.000 * HIGH + LOW) + OPEN) + 2.000 * CLOSE) / 7.000,VOL / SUM(AMOUNT, 13.000) /
AMOUNT / VOL / 100.000 / 100.000)) / DMA(((( 3.000 * HIGH + LOW) + OPEN) + 2.000 * CLOSE) / 7.000,VOL /
SUM(AMOUNT, 13.000) / AMOUNT / VOL / 100.000 / 100.000) * 100.000 < (0 - 18.000));
A05:=((CLOSE - MIN(REF(CLOSE, 5.000) * 0.865,REF(CLOSE, 21.000) * 0.772)) / CLOSE < 0.009);
A06:=((A03 AND A04) AND A05);
A07:=(((((OPEN < EMA(CLOSE, 5.000)) AND (CLOSE = HIGH)) AND (CLOSE / OPEN >= 1.105)) AND (VOL / CAPITAL >=
0.019)) AND (VOL / CAPITAL <= 0.200));
A08:=(A07 AND (COUNT(A07, 5.000) = 1.000));
A09:=((((((((((((MA(CLOSE, 3.000) > REF(MA(CLOSE, 3.000), 1.000)) AND (MA(CLOSE, 5.000) > REF(MA(CLOSE,
5.000), 1.000))) AND (MA(CLOSE, 10.000) > REF(MA(CLOSE, 10.000), 1.000))) AND (VOL / 240.000 > REF(VOL,
30.000) * 1.200 / 240.000 * 1.500)) AND (CLOSE > LOW * 1.059)) AND (CLOSE > REF(MA(CLOSE, 3.000),
1.000))) AND REF(CLOSE, 1.000)) AND (MA(CLOSE, 5.000) > REF(MA(CLOSE, 5.000), 1.000))) AND (MA(CLOSE,
10.000) > REF(MA(CLOSE, 10.000), 1.000))) AND (MA(CLOSE, 20.000) > REF(MA(CLOSE, 20.000), 1.000))) AND (MA
(VOL, 5.000) > REF(MA(VOL, 5.000), 1.000))) AND ((MA(CLOSE, 5.000) - MA(CLOSE, 10.000)) <= 0.579));
A0A:=FILTER(A09, 5.000);
牛股:STICKLINE((A06 OR A07) AND A0A,0,0.5,2,0),COLORRED;
AMACD:=ABS(MACD);
VAR7Z:=EMA(AMOUNT/VOL/100,3);
VAR8Z:=EMA(VAR7Z,88);
VAR9Z:=EMA(VAR7Z,88)*0.85;
VARA:=VAR9Z*0.87;
VARB:=LOW<VARA AND CLOSE>REF(CLOSE,1)*1.02;
STICKLINE(FILTER(VARB,6),0,0.3,3,0),COLORRED;
N1:=7;
LC:=REF(CLOSE,1);
X:=SMA(MAX(CLOSE-LC,0),N1,1)/SMA(ABS(CLOSE-LC),N1,1)*100;
Y:=DRAWLINE(X>=HHV(X,N1),X,X<=LLV(X,N1),X,1);
TJ1:=X=Y;
TJ2:=X<REF(X,1);
绝对买底:STICKLINE(TJ1 AND TJ2,0,-0.22,2,0),COLORYELLOW;
{STICKLINE(MACD>=0 AND MACD>=REF(MACD,1),0,MACD,W,1),COLOR6058FF;
STICKLINE(MACD>=0 AND MACD< REF(MACD,1),0,MACD,W,0),COLOR6058FF;
STICKLINE(MACD<0 AND MACD>=REF(MACD,1),0,MACD,W,1),COLORFFFF00;
STICKLINE(MACD<0 AND MACD< REF(MACD,1),0,MACD,W,0),COLORFFFF00;}
红柱面积 := IF (MACD>0,SUM(AMACD,BARSLAST(MACD<0)),0),LINETHICK0,COLORRED;
绿柱面积 := IF (MACD<0,SUM(AMACD,BARSLAST(MACD>0)),0),LINETHICK0,COLORBLUE;
BV:=SUM(MACD,0);
红转绿:=CROSS(MACD,0);
绿转红:=CROSS(0,MACD);
BC:=BARSLAST(红转绿 OR 绿转红)+1;
最高红柱子:IF(MACD>0,HHV(MACD,BC),0),NODRAW;
最低绿柱子:IF(MACD<0,LLV(MACD,BC),0),NODRAW;
DRAWTEXT(绿转红 ,REF(最高红柱子,1),''+REF(INTPART((红柱面积)*10)/10,1)),COLORRED;
DRAWTEXT(红转绿 ,REF(最低绿柱子,1),''+REF(INTPART((绿柱面积)*10)/10,1)),COLORRED;
CDIFF:DIFF;CDEA:DEA;
金叉:=CROSS(DIFF,DEA) AND DIFF<0.3;
STICKLINE(金叉,0,-0.2,3,0),COLOR0000FF;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
B1:=REF(C,A1+1)>C AND REF(DIFF,A1+1)<DIFF AND CROSS(DIFF,DEA);
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));
A3:=BARSLAST(REF(CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24)),1));
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));
C1:=BARSLAST(REF(CROSS(DEA,DIFF),1));
D1:=REF(C,C1+1)<C AND REF(DIFF,C1+1)>DIFF AND CROSS(DEA,DIFF);
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));
C3:=BARSLAST(REF(CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24)),1));
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));
DIFF,COLORGREEN;
DEA,COLORYELLOW;
强:IF(DIFF>MA(DIFF,2),DIFF,DRAWNULL),COLORRED,LINETHICK2;
弱:IF(DEA>MA(DEA,2),DEA,DRAWNULL),COLORMAGENTA,LINETHICK2;
A:=REF(DIFF,1)<REF(DIFF,2) AND REF(DIFF,2)<REF(DIFF,3) AND DIFF>REF(DIFF,1);
B:=REF(DIFF,1)>REF(DIFF,2) AND REF(DIFF,2)>REF(DIFF,3) AND DIFF<REF(DIFF,1);
DD:=C=HHV(C,180);
EE:=DEA< REF(DEA,1) AND REF(DEA< REF(DEA,1),1)=1;
CC:=C> REF(C,1) AND REF(C> REF(C,1),1)=1;
上升背离:(CC AND EE)*DEA,COLOR00FFFF;
顶背离:(DD AND EE AND DEA< HHV(DEA,180))*DEA,STICK,LINETHICK3,COLORGREEN;
FF:=C=LLV(C,180);
GG:= DEA> REF(DEA,1) AND REF(DEA> REF(DEA,1),1)=1;
LL:=C< REF(C,1) AND REF(C< REF(C,1),1)=1;
下降背离:(LL AND GG)*DEA,COLORMAGENTA;
底背离:(FF AND GG AND DEA> LLV(DEA,180))*DEA,STICK,LINETHICK3,COLORRED;
MMZ:=IF(MACD< 0,MACD,0);
JJ:=MMZ> REF(MMZ,1);
ZZ:=REF(JJ,1)=1;
介入区:(JJ AND ZZ)*DEA,POINTDOT,COLORYELLOW;{MACD蓝柱缩短---指今日比昨天短}
STICKLINE(介入区=DEA,DEA,DIFF,0.5,1),COLORYELLOW;
{DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26); }
上穿零线:STICKLINE(COUNT(DIFF>=0,60)=1 AND DIFF>=0,0,0.2,2,0),COLORYELLOW;
下穿零线:STICKLINE(COUNT(DIFF<=0,60)=1 AND DIFF<=0,0.2,0.25,3,0),COLORGREEN;
低位金叉:IF(CROSS(DIFF,DEA) AND DIFF<-0.1,0.3,0),COLORYELLOW,POINTDOT;
STICKLINE(低位金叉,0,-0.2,8,1),COLORYELLOW;
DRAWICON(低位金叉,-0.3,1);
JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
二次金叉:IF(CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1,0.2,0),COLORFF00FF,POINTDOT;
STICKLINE(二次金叉,0,0.15,8,1),COLORFF00FF;
A1Z:=BARSLAST(REF(CROSS(DIFF,DEA),1));
底背离Z:IF(REF(CLOSE,A1Z+1)>CLOSE AND DIFF>REF(DIFF,A1Z+1) AND CROSS(DIFF,DEA),0.1,0),COLORRED,POINTDOT;
STICKLINE(底背离Z,0,-0.15,8,1),COLORMAGENTA;
DRAWLINE(A1Z=0,DEA,底背离Z,DEA,0),COLORMAGENTA,LINETHICK3;
A2Z:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离Z:IF(REF(CLOSE,A2Z+1)<CLOSE AND REF(DIFF,A2Z+1)>DIFF AND CROSS(DEA,DIFF),0.3,0),COLORGREEN;
DRAWLINE(A2Z=0,DEA,顶背离Z,DEA,0),COLORBLUE,LINETHICK3;
A3Z:=CROSS(DIFF,DEA) AND DEA<0;
零下二次金叉:IF(FILTER(COUNT(A3Z,21)=2,10),0.05,0),COLORWHITE,POINTDOT;
STICKLINE(零下二次金叉,0,-0.1,8,1),COLORWHITE;
金叉1:DRAWICON(CROSS(DIFF,DEA),DIFF,1);
死叉1:DRAWICON(CROSS(DEA,DIFF),DIFF,2);
DRAWTEXT(REF(CLOSE,A2Z+1)<CLOSE AND REF(DIFF,A2Z+1)>DIFF AND CROSS(DEA,DIFF),0.25,'顶背离'),COLORGREEN;
DRAWTEXT(REF(CLOSE,A1Z+1)>CLOSE AND DIFF>REF(DIFF,A1Z+1) AND CROSS(DIFF,DEA),-0.14,'底背离'),COLORRED,POINTDOT;
DRAWTEXT(COUNT(DIFF>=0,60)=1 AND DIFF>=0,0.18,'上穿零线'),COLORYELLOW;
DRAWTEXT(COUNT(DIFF<=0,60)=1 AND DIFF<=0,0.2,'下穿零线'),COLORGREEN;
DRAWTEXT(CROSS(DIFF,DEA ),-0.16,'金↗'),COLORYELLOW;
DRAWTEXT(CROSS(DEA,DIFF ),0.1,'死↘'),COLORFFFF00;
DRAWTEXT(FILTER(VARB,6),0.26,'坚决买进'),COLORFF00FF;
DRAWTEXT(TJ1 AND TJ2,-0.23,'绝对买底'),COLORYELLOW;
DRAWICON(CROSS(DIFF,DEA),DEA,26);
DRAWICON(CROSS(DEA,DIFF),DEA,27);
{DRAWICON(A,DIFF,1);}
DRAWICON(B,DIFF,2);
DRAWTEXT((A06 OR A07) AND A0A,0.51,'▲←超级黑马'),COLORRED;
654388753.png
|