KD-MACD
公式虽然有点乱,但是很不错的
DRAWGBK(CLOSE>0,COLORRGB(1,1841,3411),COLORRGB(1,1881,6532),3);
KX:=SYSPARAM(3)-SYSPARAM(2)+1;
KH:=HHV(HIGH,KX);
KL:=LLV(LOW,KX);
KMX:=KH[DATACOUNT];
KMN:=KL[DATACOUNT];
KBL:=(KMX+KMN)/2;
KGDC:=KMX-KMN;
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:SMA(RSV,3,1),LINETHICK0,colorFFFFFF;
D:SMA(K,3,1),LINETHICK0,colorDDDD;
J:3*K-2*D,LINETHICK0,colorBB00BB;
KA:=HHV(K,KX);
DA:=HHV(D,KX);
JA:=HHV(J,KX);
KB:=LLV(K,KX);
DB:=LLV(D,KX);
JB:=LLV(J,KX);
MXAK:=MAX(KA[DATACOUNT],MAX(DA[DATACOUNT],JA[DATACOUNT]));
MNAK:=MIN(KB[DATACOUNT],MIN(DB[DATACOUNT],JB[DATACOUNT]));
KDBL:=(MXAK+MNAK)/2;
KDGDC:=MXAK-MNAK;
KC:=(K-KDBL)*KGDC/KDGDC+KBL;
DC:=(D-KDBL)*KGDC/KDGDC+KBL;
JC:=(J-KDBL)*KGDC/KDGDC+KBL;
DRAWTEXT(ISLASTBAR,(100-KDBL)*KGDC/KDGDC+KBL+0.08,' 100'),colorFF00;
DRAWTEXT(ISLASTBAR,(80-KDBL)*KGDC/KDGDC+KBL+0.08,' 80'),colorFFFFCC;
DRAWTEXT(ISLASTBAR,(50-KDBL)*KGDC/KDGDC+KBL+0.08,' 50'),colorFFFFFF;
DRAWTEXT(ISLASTBAR,(20-KDBL)*KGDC/KDGDC+KBL+0.08,' 20'),colorFFFF;
DRAWTEXT(ISLASTBAR,(-KDBL)*KGDC/KDGDC+KBL+0.08,' 0'),color99FF;
DIFF:EMA(CLOSE,12)-EMA(CLOSE,26),LINETHICK0,color99FF;
DEA:EMA(DIFF,9),LINETHICK0,colorDDDD;
MACD:2*(DIFF-DEA),LINETHICK0,colorCC00;
MHF:=HHV(DIFF,KX);
MHD:=HHV(DEA,KX);
MHM:=HHV(MACD,KX);
MLF:=LLV(DIFF,KX);
MLD:=LLV(DEA,KX);
MLM:=LLV(MACD,KX);
HMAX:=MAX(MHF[DATACOUNT],MAX(MHD[DATACOUNT],MHM[DATACOUNT]));
LMIN:=MIN(MLF[DATACOUNT],MIN(MLD[DATACOUNT],MLM[DATACOUNT]));
MBL:=(HMAX+LMIN)/100;
MGDC:=HMAX-LMIN;
KCA:=HHV(KC,KX);
DCA:=HHV(DC,KX);
JCA:=HHV(JC,KX);
KCB:=LLV(KC,KX);
DCB:=LLV(DC,KX);
JCB:=LLV(JC,KX);
MXAKC:=MAX(KCA[DATACOUNT],MAX(DCA[DATACOUNT],JCA[DATACOUNT]));
MNAKC:=MIN(KCB[DATACOUNT],MIN(DCB[DATACOUNT],JCB[DATACOUNT]));
KCBL:=(MXAKC+MNAKC)/2;
KCGDC:=MXAKC-MNAKC;
QD:=(-MBL)*KCGDC/MGDC+KCBL;
DIFFA:=(DIFF-MBL)*KCGDC/MGDC+KCBL;
DEAA:=(DEA-MBL)*KCGDC/MGDC+KCBL;
MACDA:=(MACD-MBL)*KCGDC/MGDC+KCBL;
CDA:=IF(MACD<REF(MACD,1) AND MACD>0,1,0);
CDB:=IF(MACD>=REF(MACD,1) AND MACD>0,1,0);
CDC:=IF(MACD>REF(MACD,1) AND MACD<0,1,0);
CDD:=IF(MACD<=REF(MACD,1) AND MACD<0,1,0);
STICKLINE(CDA,QD,MACDA,8,0),colorAADD;
STICKLINE(CDA,QD,MACDA,6.6,0),colorAADD;
STICKLINE(CDA,QD,MACDA,4.4,0),colorBBDD;
STICKLINE(CDA,QD,MACDA,3.3,0),colorBBDD;
STICKLINE(CDA,QD,MACDA,2.2,0),colorCCDD;
STICKLINE(CDA,QD,MACDA,1.1,0),colorDDDD;
STICKLINE(CDB,QD,MACDA,8,0),colorCC33DD;
STICKLINE(CDB,QD,MACDA,6.6,0),colorDD22DD;
STICKLINE(CDB,QD,MACDA,4.4,0),colorBB44DD;
STICKLINE(CDB,QD,MACDA,3.3,0),colorBB55DD;
STICKLINE(CDB,QD,MACDA,2.2,0),colorAA66DD;
STICKLINE(CDB,QD,MACDA,1.1,0),colorAA77DD;
STICKLINE(CDC,QD,MACDA,8,0),colorAA00AA;
STICKLINE(CDC,QD,MACDA,6.6,0),colorAA00AA;
STICKLINE(CDC,QD,MACDA,4.4,0),colorBB11AA;
STICKLINE(CDC,QD,MACDA,3.3,0),colorAA22AA;
STICKLINE(CDC,QD,MACDA,2.2,0),colorCC33AA;
STICKLINE(CDC,QD,MACDA,1.1,0),colorDD44AA;
STICKLINE(CDD,QD,MACDA,8,0),colorCC1111;
STICKLINE(CDD,QD,MACDA,6.6,0),colorCC2211;
STICKLINE(CDD,QD,MACDA,4.4,0),colorCC3311;
STICKLINE(CDD,QD,MACDA,3.3,0),colorCC4411;
STICKLINE(CDD,QD,MACDA,2.2,0),colorCC5511;
STICKLINE(CDD,QD,MACDA,1.1,0),colorCC6611;
DRAWTEXT(ISLASTBAR,QD,' 0'),colorAAAA;
KX1:=CLOSE>=OPEN OR CLOSE>REF(CLOSE,1);
STICKLINE(KX1,CLOSE,OPEN,7,0),color11AA;
STICKLINE(KX1,CLOSE,OPEN,5,0),color22AA;
STICKLINE(KX1,CLOSE,OPEN,3,0),color33AA;
STICKLINE(KX1,CLOSE,OPEN,1,0),color44AA;
STICKLINE(KX1,HIGH,LOW,0,0),colorDD;
KX2:=CLOSE<OPEN;
STICKLINE(KX2,CLOSE,OPEN,7,0),color7B7B00;
STICKLINE(KX2,CLOSE,OPEN,5,0),color909000;
STICKLINE(KX2,CLOSE,OPEN,3,0),colorA8A800;
STICKLINE(KX2,CLOSE,OPEN,1,0),colorCECE00;
STICKLINE(KX2,HIGH,LOW,0,0),colorFFFF00;
PARTLINE(KC,KC),LINETHICK2,colorFFFFFF;
PARTLINE(DC,DC),LINETHICK2,colorDDDD;
PARTLINE(JC>0 OR JC<0,JC),LINETHICK2,colorBB00BB;
RSV1:=(HHV(HIGH,9.8)-CLOSE)/(HHV(HIGH,9.8)-LLV(LOW,9.8))*101;
KK:=SMA(RSV1,3,1);
DD:=SMA(KK,3,1);
JJ:=3*KK-2*DD;
买卖:=IF(JJ>=100,100,IF(JJ<=0,0,JJ));
低买:IF(买卖=100,((-KDBL)*KGDC/KDGDC+KBL)*0.98,(-KDBL)*KGDC/KDGDC+KBL),colorCCCC;
高卖:IF(买卖=0,(90-KDBL)*KGDC/KDGDC+KBL,(100-KDBL)*KGDC/KDGDC+KBL),colorCCAA;
PARTLINE(DIFF>0 OR DIFF<0,DIFFA),POINTDOT,color99EE;
PARTLINE(DEA>0 OR DEA<0,DEAA),POINTDOT,colorDDAAAA;
TYP:=(HIGH+LOW+CLOSE)/3;
CCI:=(TYP-MA(TYP,14))/(0.015*AVEDEV(TYP,14));
PARTLINE(CDB OR CDC OR 低买<0 AND CCI<-10 OR CDA AND DIFF/DEA>=REF(DIFF/DEA,1),(20-KDBL)*KGDC/KDGDC+KBL),POINTDOT,colorAA11BB;
PARTLINE(低买>=0 AND (CDD OR CDA AND DIFF/DEA<REF(DIFF/DEA,1)),(20-KDBL)*KGDC/KDGDC+KBL),POINTDOT,colorBB00;
PARTLINE(K>=REF(K,1),(80-KDBL)*KGDC/KDGDC+KBL),POINTDOT,colorAA11BB;
PARTLINE(K<REF(K,1),(80-KDBL)*KGDC/KDGDC+KBL),POINTDOT,colorBB00;
PARTLINE(CLOSE,(50-KDBL)*KGDC/KDGDC+KBL),POINTDOT,colorBBBB;
ZLZC:=IF(CLOSE=INDEXC,(INDEXC+INDEXH+INDEXL+INDEXO)/4,AMOUNT/(VOL+0.01)/100);
明日阻力:=LOW+ZLZC-LOW+CLOSE-LOW;
明日支撑:=LOW+CLOSE-ZLZC;
今阻:REF(明日阻力,1),LINETHICK0,colorCC00DD;
今撑:REF(明日支撑,1),LINETHICK0,colorDD00;
DRAWTEXT(ISLASTBAR,今阻,'------'),colorCC00CC;
DRAWTEXT(ISLASTBAR,今撑,'------'),colorCC00;
STICKLINE(ISLASTBAR AND CLOSE>=今阻,今阻,今阻,20,0),colorCC00CC;
STICKLINE(ISLASTBAR AND CLOSE<今阻,今阻,今阻,20,0),colorDD00;
STICKLINE(ISLASTBAR AND CLOSE>=今撑,今撑,今撑,20,0),colorDD00;
STICKLINE(ISLASTBAR AND CLOSE<今撑,今撑,今撑,20,0),colorCC00CC;
MRZY:=ROUND(((REF(HIGH,1)-REF(LOW,1))*8/10+CLOSE)*100)/100;
MRZS:=ROUND((CLOSE-(REF(HIGH,1)-REF(LOW,1))*8/20)*100)/100;
STICKLINE(CLOSE>OPEN AND ISLASTBAR,MRZY,MRZS,8,1),SHIFT1,colorFF00FF;
STICKLINE(CLOSE<=OPEN AND ISLASTBAR,MRZY,MRZS,8,1),SHIFT1,colorFFFF00;
MA5:=MA(CLOSE,5);
MA13:=MA(CLOSE,13);
MA25:=MA(CLOSE,25);
MACD金叉:=CROSS(MACD,DIFF) AND MACD>=-0.05 AND MACD<=0.02;
DRAWTEXT(MACD金叉,MACDA-0.03,'MACD金叉'),colorFFFF;
XX:=FFT(MA(LOW,3)*0.96,30);
DIFF金叉:=IF(CROSS(DIFF,DEA) AND XX-REF(XX,1)>0 AND MACD>=REF(MACD,1) AND DIFF<=0,1,0);
DRAWTEXT(DIFF金叉=1,DIFFA*1.028,'DIFF金叉'),colorCDFFBB;
低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.1;
DRAWTEXT(低位金叉,DIFFA*0.996,' 低位金叉'),color99DD;
JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
二次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;
DRAWTEXT(二次金叉,DEAA*0.99,' 二次金叉'),ALIGN0,colorFF00FF;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
DRAWTEXT(底背离,DEAA*0.97,' 底背离'),color99FF;
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIFF,A2+1)>DIFF AND CROSS(DEA,DIFF);
DRAWTEXT(FILTER(顶背离,5),DEAA*1.02,'顶背离'),colorDDAAAA;
周DIFF:="MACD.DIFF#week";
周DEA:="MACD.DEA#week";
周MACD:="MACD.MACD#week";
DIF周金叉:=CROSS(周DIFF,周DEA);
DRAWTEXT(DIF周金叉,DEAA,'DIF周金叉'),colorFFCC;
DRAWTEXT(CROSS(周DEA,周DIFF),DEAA*1.01,'DI |