kaj叠加macd的指标加上背离和二次金叉的符号
更多金钻指标股票技术讨论QQ群:966329692 技术讨论QQ群:220302856 技术讨论QQ群:39652085 如群满可换一个
编写要求:
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;K:SMA(RSV,3,1),LINETHICK2,COLORWHITE;D:SMA(K,3,1),LINETHICK2,COLORYELLOW;J:3*K-2*D,LINETHICK2,COLORRED;DIFF:EMA(CLOSE,12)-EMA(CLOSE,26),LINETHICK2,COLORGREEN,LINETHICK0;DEA :EMA(DIFF,9),LINETHICK2,COLORBLUE,LINETHICK0;MACD:2*(DIFF-DEA),LINETHICK2,COLORRED,LINETHICK0;RSV1:=(HHV(H,9.8)-C)/(HHV(H,9.8)-LLV(L,9.8))*101; KK:=SMA(RSV1,3,1); DD:=SMA(KK,3,1); JJ:=3*KK-2*DD; KX:=250; KH:=HHV(K,KX); DH:=HHV(D,KX); JH:=HHV(J,KX); KL:=LLV(K,KX); DL:=LLV(D,KX); JL:=LLV(J,KX); HKMAX:=MAX(KH,MAX(DH,JH)); LKMIN:=MIN(KL,MIN(DL,JL)); KHLB:=(HKMAX+LKMIN)/2; KHLC:=HKMAX-LKMIN; 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,MAX(MHD,MHM)); LMIN:=MIN(MLF,MIN(MLD,MLM)); FHLB:=(HMAX-LMIN)/100; FHLC:=HMAX-LMIN; SH:=(0-FHLB)*(KHLC/FHLC)+KHLB; DIFFA:=(DIFF-FHLB)*(KHLC/FHLC)+KHLB; DEAA:=(DEA-FHLB)*(KHLC/FHLC)+KHLB;DRAWBAND(DIFFA,RGB(255,11,11),DEAA,RGB(10,255,10)); MACDA:=(MACD-FHLB)*(KHLC/FHLC)+KHLB; CDA:=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;STICKLINE(CDA,SH,MACDA,2.8,0),COLOR00AAFF;{黄色段}STICKLINE(CDA,SH,MACDA,2.7,0),COLOR00BBFF;STICKLINE(CDA,SH,MACDA,2.4,0),COLOR00CCFF;STICKLINE(CDA,SH,MACDA,2.3,0),COLOR00DDFF;STICKLINE(CDA,SH,MACDA,2.2,0),COLOR00EEFF;STICKLINE(CDA,SH,MACDA,1.1,0),COLOR00FFFF;STICKLINE(CDB,SH,MACDA,2.8,0),COLOR0000AA; {红色段}STICKLINE(CDB,SH,MACDA,2.7,0),COLOR0011BB; STICKLINE(CDB,SH,MACDA,2.4,0),COLOR0022CC;STICKLINE(CDB,SH,MACDA,2.3,0),COLOR0033DD; STICKLINE(CDB,SH,MACDA,2.2,0),COLOR0044EE; STICKLINE(CDB,SH,MACDA,1.1,0),COLOR0055FF;STICKLINE(CDC,SH,MACDA,2.8,0),COLORAA00BB;{向上粉红}STICKLINE(CDC,SH,MACDA,2.7,0),COLORBB11BB;STICKLINE(CDC,SH,MACDA,2.4,0),COLORCC22BB;STICKLINE(CDC,SH,MACDA,2.3,0),COLORDD33BB; STICKLINE(CDC,SH,MACDA,2.2,0),COLOREE44BB; STICKLINE(CDC,SH,MACDA,1.1,0),COLORFF55BB;STICKLINE(CDD,SH,MACDA,2.8,0),COLORFF7700;STICKLINE(CDD,SH,MACDA,2.7,0),COLORFF8811; STICKLINE(CDD,SH,MACDA,2.4,0),COLORFFAA22;STICKLINE(CDD,SH,MACDA,2.3,0),COLORFFBB33; STICKLINE(CDD,SH,MACDA,2.2,0),COLORFFDD44; STICKLINE(CDD,SH,MACDA,1.1,0),COLORFFDD55;DRAWTEXT(BARSTATUS=2,SH,' 0轴'),COLOR00AAAA;VAR51:=(CLOSE-LLV(LOW,32))/(HHV(HIGH,32)-LLV(LOW,32))*100;VAR52:=SMA(VAR51,4,1);VAR53:=SMA(VAR52,6,1);VAR54:=VOL/CAPITAL*34;VAR55:=REF(VAR54,1);STICKLINE(VAR53<7 AND VAR52<11,-5,0,3,0),LINETHICK2 ,COLORYELLOW ;STICKLINE(VAR53>89.5 AND VAR52>91,100,95,3,0) ,LINETHICK1 ,COLORFFB210 ;STICKLINE(VAR53>88.5 AND VAR52>94.6,100,96,3,0),,COLORRED]
解答:
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:SMA(RSV,3,1),LINETHICK2,COLORWHITE;
D:SMA(K,3,1),LINETHICK2,COLORYELLOW;
J:3*K-2*D,LINETHICK2,COLORRED;
DIFF:EMA(CLOSE,12)-EMA(CLOSE,26),LINETHICK2,COLORGREEN,LINETHICK0;
DEA :EMA(DIFF,9),LINETHICK2,COLORBLUE,LINETHICK0;
MACD:2*(DIFF-DEA),LINETHICK2,COLORRED,LINETHICK0;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
B1:=REF(C,A1+1)>C AND REF(DIFF,A1+1)<DIFF AND CROSS(DIFF,DEA);
MACD底背离:=FILTER(B1>0,5);
DRAWTEXT(MACD底背离,DIFF,'▲'),COLORRED;
C1:=BARSLAST(REF(CROSS(DEA,DIFF),1));
D1:=REF(C,C1+1)<C AND REF(DIFF,C1+1)>DIFF AND CROSS(DEA,DIFF);
MACD顶背离:=FILTER(D1>0,5);
DRAWTEXT(MACD顶背离,DIFF,'▼'),COLORGREEN;
低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.1;
JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
二次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;
DRAWTEXT(二次金叉,MACD*0.1,'二金'),COLORRED;
RSV1:=(HHV(H,9.8)-C)/(HHV(H,9.8)-LLV(L,9.8))*101;
KK:=SMA(RSV1,3,1);
DD:=SMA(KK,3,1);
JJ:=3*KK-2*DD;
KX:=250;
KH:=HHV(K,KX);
DH:=HHV(D,KX);
JH:=HHV(J,KX);
KL:=LLV(K,KX);
DL:=LLV(D,KX);
JL:=LLV(J,KX);
HKMAX:=MAX(KH,MAX(DH,JH));
LKMIN:=MIN(KL,MIN(DL,JL));
KHLB:=(HKMAX+LKMIN)/2;
KHLC:=HKMAX-LKMIN;
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,MAX(MHD,MHM));
LMIN:=MIN(MLF,MIN(MLD,MLM));
FHLB:=(HMAX-LMIN)/100;
FHLC:=HMAX-LMIN;
SH:=(0-FHLB)*(KHLC/FHLC)+KHLB;
DIFFA:=(DIFF-FHLB)*(KHLC/FHLC)+KHLB;
DEAA:=(DEA-FHLB)*(KHLC/FHLC)+KHLB;
DRAWBAND(DIFFA,RGB(255,11,11),DEAA,RGB(10,255,10));
MACDA:=(MACD-FHLB)*(KHLC/FHLC)+KHLB;
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;
STICKLINE(CDA,SH,MACDA,2.8,0),COLOR00AAFF;{黄色段}
STICKLINE(CDA,SH,MACDA,2.7,0),COLOR00BBFF;
STICKLINE(CDA,SH,MACDA,2.4,0),COLOR00CCFF;
STICKLINE(CDA,SH,MACDA,2.3,0),COLOR00DDFF;
STICKLINE(CDA,SH,MACDA,2.2,0),COLOR00EEFF;
STICKLINE(CDA,SH,MACDA,1.1,0),COLOR00FFFF;
STICKLINE(CDB,SH,MACDA,2.8,0),COLOR0000AA; {红色段}
STICKLINE(CDB,SH,MACDA,2.7,0),COLOR0011BB;
STICKLINE(CDB,SH,MACDA,2.4,0),COLOR0022CC;
STICKLINE(CDB,SH,MACDA,2.3,0),COLOR0033DD;
STICKLINE(CDB,SH,MACDA,2.2,0),COLOR0044EE;
STICKLINE(CDB,SH,MACDA,1.1,0),COLOR0055FF;
STICKLINE(CDC,SH,MACDA,2.8,0),COLORAA00BB;{向上粉红}
STICKLINE(CDC,SH,MACDA,2.7,0),COLORBB11BB;
STICKLINE(CDC,SH,MACDA,2.4,0),COLORCC22BB;
STICKLINE(CDC,SH,MACDA,2.3,0),COLORDD33BB;
STICKLINE(CDC,SH,MACDA,2.2,0),COLOREE44BB;
STICKLINE(CDC,SH,MACDA,1.1,0),COLORFF55BB;
STICKLINE(CDD,SH,MACDA,2.8,0),COLORFF7700;
STICKLINE(CDD,SH,MACDA,2.7,0),COLORFF8811;
STICKLINE(CDD,SH,MACDA,2.4,0),COLORFFAA22;
STICKLINE(CDD,SH,MACDA,2.3,0),COLORFFBB33;
STICKLINE(CDD,SH,MACDA,2.2,0),COLORFFDD44;
STICKLINE(CDD,SH,MACDA,1.1,0),COLORFFDD55;
DRAWTEXT(ISLASTBAR,SH,'0轴'),COLOR00AAAA;
VAR51:=(CLOSE-LLV(LOW,32))/(HHV(HIGH,32)-LLV(LOW,32))*100;
VAR52:=SMA(VAR51,4,1);
VAR53:=SMA(VAR52,6,1);
VAR54:=VOL/CAPITAL*34;
VAR55:=REF(VAR54,1);
STICKLINE(VAR53<7 AND VAR52<11,-5,0,3,0),LINETHICK2 ,COLORYELLOW ;
STICKLINE(VAR53>89.5 AND VAR52>91,100,95,3,0) ,LINETHICK1 ,COLORFFB210 ;
STICKLINE(VAR53>88.5 AND VAR52>94.6,100,96,3,0),,COLORRED;
选股票看什么指标最好 >
股票指标网
精彩评论