飞狐大道至简MACD副图指标
源码
{大道至简MACD}
DRAWGBK(1,COLORRGB(30,20,50),COLORRGB(0,0,0),1);
DIFF: EMA(CLOSE,12) - EMA(CLOSE,26),COLORRED;
DEA : EMA(DIFF,9),COLORYELLOW;
MACD:=2*(DIFF-DEA), COLORSTICK;
CDA:=MACD<ref(MACD,1) and MACD>0;
CDB:=MACD>=ref(MACD,1) and MACD>0;
CDC:=MACD>ref(MACD,1) and MACD<0;
CDD:=MACD<=ref(MACD,1) and MACD<0;
PARTLINE(DIFF<REF(DIFF,1),DIFF),COLORFFBB33;
PARTLINE(DEA<REF(DEA,1),DEA),COLOR11BB33;
STICKLINE(CDA,0,macd,5,0),COLOR00AAFF;{黄色段}
STICKLINE(CDA,0,macd,4,0),COLOR00BBFF;
STICKLINE(CDA,0,macd,3,0),COLOR00CCFF;
STICKLINE(CDA,0,macd,2,0),COLOR00DDFF;
STICKLINE(CDA,0,macd,1,0),COLOR00EEFF;
STICKLINE(CDA,0,macd,0.1,0),COLOR00FFFF;
STICKLINE(CDB,0,macd,5,0),COLOR0000AA; {红色段}
STICKLINE(CDB,0,macd,4,0),COLOR0011BB;
STICKLINE(CDB,0,macd,3,0),COLOr0022CC;
STICKLINE(CDB,0,macd,2.3,0),COLOR0033DD;
STICKLINE(CDB,0,macd,1.2,0),COLOR0044EE;
STICKLINE(CDB,0,macd,0.1,0),COLOR0055FF;
STICKLINE(CDC,0,macd,5,0),COLORAA00BB;{向上粉红}
STICKLINE(CDC,0,macd,4,0),COLORBB11BB;
STICKLINE(CDC,0,macd,3,0),COLORCC22BB;
STICKLINE(CDC,0,macd,2,0),COLORDD33BB;
STICKLINE(CDC,0,macd,1.2,0),COLOREE44BB;
STICKLINE(CDC,0,macd,0.1,0),COLORFF55BB;
STICKLINE(CDD,0,macd,5,0),COLORFF7700;
STICKLINE(CDD,0,macd,4,0),COLORFF8811;
STICKLINE(CDD,0,macd,3,0),COLORFFAA22;
STICKLINE(CDD,0,macd,2,0),COLORFFBB33;
STICKLINE(CDD,0,macd,1.2,0),COLORFFDD44;
STICKLINE(CDD,0,macd,0.1,0),COLORFFDD55;
Var1:=LOW=LLV(LOW,120) OR REF(LOW,1)=LLV(REF(LOW,1),120) OR REF(LOW,2)=LLV(REF(LOW,2),120);
Var2:=CLOSE/REF(CLOSE,1)>=1.06;
反转点1:if(Var1 AND Var2,0.5,0),colorff00ff;
Var3:=(CLOSE-MA(CLOSE,12))/MA(CLOSE,12)*100;
Var4:=(CLOSE-MA(CLOSE,24))/MA(CLOSE,24)*100;
反转点2:if(CROSS(Var4,-20)+0,0.5,0),coloryellow;
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
J:=3*K-2*D;
关注点:if(CROSS(CLOSE,MA(CLOSE,5)) AND CROSS(CLOSE,MA(CLOSE,10)) AND CROSS(CLOSE,MA(CLOSE,20)) AND CROSS(Var3,0) AND CROSS(Var4,0) AND (CROSS(CLOSE,MA(CLOSE,5)) AND CROSS(CLOSE,MA(CLOSE,10)) AND CROSS(CLOSE,MA(CLOSE,20)) AND CROSS(Var3,0) AND CROSS(Var4,0)),0.5,0),COLORbbEE00;
Var5:=EMA(CLOSE,12)*2-EMA(CLOSE,26)*2;
Var6:=EMA(Var5,9);
BIAS3:=(CLOSE-MA(CLOSE,24))/MA(CLOSE,24)*100;
金叉点:if(Var5<-0.9 AND Var6<=-0.7 AND CROSS(Var5,Var6) OR Var5<-0.5 AND Var6<-0.6 AND CROSS(Var5,Var6) AND J>89 OR Var5<-0.5 AND Var6<-0.5 AND CROSS(Var5,Var6) and bias3<-4.5-0.75,0.5,0),colorgreen;
DRAWICON(Var5<-0.9 AND Var6<=-0.7 AND CROSS(Var5,Var6),dea*0.9,1);
DRAWICON(Var5<-0.5 AND Var6<-0.6 AND CROSS(Var5,Var6) AND J>89,dea*0.9,1);
DRAWICON(Var5<-0.5 AND Var6<-0.5 AND CROSS(Var5,Var6) AND BIAS3<-4.5,dea*0.9,1);
a:=if(CROSS(dea,0),1,0);
a1:=if(diff>0 and CROSS(diff,dea),1,0);
SS:=IF(A,SUM(A1,0),0);
SSB:=HHV(SS,0);
SSS:=SUM(A1,0);
上金叉:IF(SSS-SSB=2 AND SSS>REF(SSS,1),0.5,0),COLORFFBB33;
VAR2A:=(HIGH - LOW);
VAR3A:=ABS((OPEN - CLOSE));
VAR4A:=(HIGH - IF((CLOSE > OPEN),CLOSE,OPEN));
VAR5A:=(IF((CLOSE > OPEN),OPEN,CLOSE) - LOW);
VAR6A:=((VAR3A / VAR2A) * VOL);
VAR7A:=((VAR4A / VAR2A) * VOL);
VAR8A:=((VAR5A / VAR2A) * VOL);
VAR9A:=IF(((VOL / CAPITAL) > 0.001),1,EXP(ABS(LOG(((VOL / CAPITAL) * 100)))));
VARA:=(((CLOSE - MA(CLOSE,5)) / MA(CLOSE,5)) * 100);
VARB:=(((MA(CLOSE,5) > MA(CLOSE,10)) AND (MA(CLOSE,10) > MA(CLOSE,30))) AND (MA(CLOSE,30) > MA(CLOSE,60)));
VARC:=((MA(CLOSE,5) < MA(CLOSE,10)) AND (MA(CLOSE,10) < MA(CLOSE,30)));
VARD:=REF(CLOSE,1);
VARE:=((SMA(MAX((CLOSE - VARD),0),6,1) / SMA(ABS((CLOSE - VARD)),6,1)) * 100);
DRAWTEXT(((DATE > 700101) AND CROSS(84,VARE)),DIFF,'小心'),colorwhite;
A11:=BARSLAST(REF(CROSS(DIFF,DEA),1));
底背离:=REF(CLOSE,A11+1)>CLOSE AND DIFF>REF(DIFF,A11+1) AND CROSS(DIFF,DEA);
STICKLINE(底背离,0,0.1,8,0),COLORRED;
DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED;
A21:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离:=REF(CLOSE,A21+1)<CLOSE AND REF(DIFF,A21+1)>DIFF AND CROSS(DEA,DIFF);
DRAWLINE(A21=0,DEA,顶背离,DEA,0),COLORGREEN,linethick2;
xg:金叉点=0.5 or 关注点=0.5 or 反转点2=0.5 or 反转点1=0.5,linethick0;
DRAWTEXTEX(1,0,0,0,'一、大市增量上涨时入市。二、个股缩量上涨时买进。三、个股增量下跌时卖出。四、大市缩量下跌时离市。五、传统指标+千均系统=战无不胜'),ALIGN4,COLORGREEN;