公式思路:
多周期KD同列,一個副圖上同時顯示1倍,2倍,4倍,8倍,16倍周期的KD。 修改一: RSV16:=(CLOSE-LLV(LOW,144))/(HHV(HIGH,144)-LLV(LOW,144))*100;
RSV166:=SMA(RSV16,48,1); K16:=SMA(RSV166,21,1); D16:=SMA(K16,21,1); RSV8:=(CLOSE-LLV(LOW,72))/(HHV(HIGH,72)-LLV(LOW,72))*100; RSV88:=SMA(RSV8,24,1); K8:=SMA(RSV88,13,1); D8:=SMA(K8,13,1); RSV4:=(CLOSE-LLV(LOW,36))/(HHV(HIGH,36)-LLV(LOW,36))*100; RSV44:=SMA(RSV4,12,1); K4:=SMA(RSV44,8,1); D4:=SMA(K4,8,1); RSV2:=(CLOSE-LLV(LOW,18))/(HHV(HIGH,18)-LLV(LOW,18))*100; RSV22:=SMA(RSV2,6,1); K2:=SMA(RSV22,5,1),LINETHICK1,COLORWHITE; D2:=SMA(K2,5,1),LINETHICK1,COLORYELLOW; RSV1:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100; RSV11:=SMA(RSV1,3,1); K1:=SMA(RSV11,3,1),COLORRED,LINETHICK1; D1:=SMA(K1,3,1),COLOR00FF00,LINETHICK1; A0:=K16>=D16 AND K16>REF(K16,1); B0:=K16<=D16 AND K16<REF(K16,1); B10:=(K16>=D16 AND K16<REF(K16,1)) OR( K16<=D16 AND K16>REF(K16,1)); B11:=IF(B10>=0,K16,DRAWNULL);B12:=IF(B10>=0,D16,DRAWNULL);
DRAWBAND(B11,RGB(255,255,255),B12,RGB(255,255,255)); A01:=IF(A0>0,K16,DRAWNULL);A02:=IF(A0>0,D16,DRAWNULL); DRAWBAND(A01,RGB(168,128,255),A02,RGB(168,128,255)); B01:=IF(B0>0,K16,DRAWNULL);B02:=IF(B0>0,D16,DRAWNULL); DRAWBAND(B01,RGB(28,128,118),B02,RGB(28,128,118)); A:=K8>=D8&&K8>REF(K8,1); B:=K8<=D8&&K8<REF(K8,1); B1:=(K8>=D8&&K8<REF(K8,1))||(K8<=D8&&K8>REF(K8,1)); BA1:=IF(B1>=0,K8,DRAWNULL);BA2:=IF(B1>=0,D8,DRAWNULL); DRAWBAND(BA1,RGB(255,255,255),BA2,RGB(255,255,255)); AK1:=IF(A>0,K8,DRAWNULL);AK2:=IF(A>0,D8,DRAWNULL); DRAWBAND(AK1,RGB(0,158,0),AK2,RGB(0,158,0)); AB1:=IF(B>0,K8,DRAWNULL);AB2:=IF(B>0,D8,DRAWNULL); DRAWBAND(AB1,RGB(0,208,148),AB2,RGB(0,208,148)); AA:=K4>=D4&&K4>REF(K4,1);
BB:=K4<=D4&&K4<REF(K4,1); BB1:=(K4>=D4&&K4<REF(K4,1))||(K4<=D4&&K4>REF(K4,1)); BB2:=IF(BB1>=0,K4,DRAWNULL);BB3:=IF(BB1>=0,D4,DRAWNULL);
DRAWBAND(BB2,RGB(255,255,255),BB3,RGB(255,255,255)); BBK:=IF(BB>0,K4,DRAWNULL);BBD:=IF(BB>0,D4,DRAWNULL); DRAWBAND(BBK,RGB(0,108,255),BBD,RGB(0,108,255)); AAK:=IF(AA>0,K4,DRAWNULL);AAD:=IF(AA>0,D4,DRAWNULL); DRAWBAND(AAK,RGB(255,188,0),AAD,RGB(255,188,0)); 一:IF(K2>REF(K2,1),K2,K2),LINETHICK2,COLORRED; NOTEXTK2:IF(K2>REF(K2,1)AND REF(K2,1)>50,K2,DRAWNULL),LINETHICK2,COLORRED; 二:IF(D2>REF(D2,1),D2,D2),LINETHICK2,COLORYELLOW; NOTEXTD2:IF(D2<REF(D2,1),D2,DRAWNULL),LINETHICK2,COLORYELLOW; 三:IF(K1>REF(K1,1),K1,K1),LINETHICK2,COLORRED; NOTEXT1:IF(K1<REF(K1,1),K1,DRAWNULL),LINETHICK2,COLORWHITE; NOTEXTK1:IF(K1>REF(K1,1)&&REF(K1,1)>50,K1,DRAWNULL),LINETHICK2,COLORRED; 四:IF(D1>REF(D1,1),D1,D1),LINETHICK2,COLORWHITE; NOTEXTD1:IF(D1<REF(D1,1),D1,DRAWNULL),LINETHICK2,COLORWHITE; STICKLINE(K2>D2 AND K2>REF(K2,1),K2,D2,1,0),COLORRED; STICKLINE(K2<D2 AND K2<REF(K2,1),K2,D2,1,0),COLORFF0080; JCCOUNT:=BARSLAST(CROSS(K4,D4)&&K4<30); 短二金:=CROSS(K4,D4)&& K4<30&&COUNT(JCCOUNT=2,21)=1; DRAWICON(短二金,K4,1); JCCOUNT1:=BARSLAST(CROSS(K8,D8)&&K8<30); 長二金:=CROSS(K8,D8)&&K8<30&&COUNT(JCCOUNT=2,42)=1; DRAWICON(長二金,K8,1); 五浪底選股:STICKLINE(K1>REF(K1,1)&&K2>REF(K2,1)&&K2<50&&K4<=D4&&K4>K8&&K8<25,0,100,0,1),COLORYELLOW;
小三浪升選股:IF(K1<50&&K1<D1&&K1>REF(K1,1)&&K8>D8&&K8>REF(K8,1),20,0),COLORYELLOW; 七浪底選股:STICKLINE(K2>REF(K2,1)&&K4>REF(K4,1)&&K4<50&&K8<=D8 AND K8>K16&&K16<25,0,100,0,1),COLORRED; 大三浪升選股:IF(K2<50&&K2<D2&&K2>REF(K2,1)&&K16>D16&&K16>REF(K16,1),20,0),COLORRED; {OBV:=K1;}
P:=5; {A1:=REF(OBV,P)=HHV(OBV,2*P+1); B1:=FILTER(A1,P); C1:=BACKSET(B1,P+1); D1:=FILTER(C1,P);} {高點} A2:=REF(OBV,P)=LLV(OBV,2*P+1);
B2:=FILTER(A2,P); C2:=BACKSET(B2,P+1); D21:=FILTER(C2,P);{低點} VAR2:=CROSS(D1,0.90);
VAR4:=CROSS(D2,0.90); UU:=BACKSET(CURRBARSCOUNT,BARSLAST(VAR4)+1); VV:=UU>REF(UU,1); WW:=BACKSET(VV,REF(BARSLAST(VAR4),1)+2); XX:=WW>REF(WW,1); DRAWLINE(XX,OBV,VV,OBV,1),COLORWHITE; UU2:=BACKSET(CURRBARSCOUNT,BARSLAST(VAR2)+1); VV2:=UU2>REF(UU2,1); WW2:=BACKSET(VV2,REF(BARSLAST(VAR2),1)+2); XX2:=WW2>REF(WW2,1); DRAWLINE(XX2,OBV,VV2,OBV,1),COLORWHITE; 修改二:
RSV16:=(CLOSE-LLV(LOW,144))/(HHV(HIGH,144)-LLV(LOW,144))*100;
RSV166:=SMA(RSV16,48,1); K16:=SMA(RSV166,21,1); D16:=SMA(K16,21,1); RSV8:=(CLOSE-LLV(LOW,72))/(HHV(HIGH,72)-LLV(LOW,72))*100; RSV88:=SMA(RSV8,24,1); K8:=SMA(RSV88,13,1); D8:=SMA(K8,13,1); RSV4:=(CLOSE-LLV(LOW,36))/(HHV(HIGH,36)-LLV(LOW,36))*100; RSV44:=SMA(RSV4,12,1); K4:=SMA(RSV44,8,1); D4:=SMA(K4,8,1); RSV2:=(CLOSE-LLV(LOW,18))/(HHV(HIGH,18)-LLV(LOW,18))*100; RSV22:=SMA(RSV2,6,1); K2:=SMA(RSV22,5,1); D2:=SMA(K2,5,1); RSV1:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100; RSV11:=SMA(RSV1,3,1); K1:=SMA(RSV11,3,1); D1:=SMA(K1,3,1); A0:=K16>=D16&&K16>REF(K16,1); B0:=K16<=D16&&K16<REF(K16,1); B10:=(K16>=D16&&K16<REF(K16,1))||( K16<=D16&&K16>REF(K16,1)); B11:=IF(B10>=0,K16,DRAWNULL);B12:=IF(B10>=0,D16,DRAWNULL); DRAWBAND(B11,RGB(255,255,255),B12,RGB(255,255,255)); A01:=IF(A0>0,K16,DRAWNULL);A02:=IF(A0>0,D16,DRAWNULL); DRAWBAND(A01,RGB(168,128,255),A02,RGB(168,128,255)); B01:=IF(B0>0,K16,DRAWNULL);B02:=IF(B0>0,D16,DRAWNULL); DRAWBAND(B01,RGB(28,128,118),B02,RGB(28,128,118)); A:=K8>=D8&&K8>REF(K8,1); B:=K8<=D8&&K8<REF(K8,1); B1:=(K8>=D8&&K8<REF(K8,1))||(K8<=D8&&K8>REF(K8,1)); BA1:=IF(B1>=0,K8,DRAWNULL);BA2:=IF(B1>=0,D8,DRAWNULL); DRAWBAND(BA1,RGB(255,255,255),BA2,RGB(255,255,255)); AK1:=IF(A>0,K8,DRAWNULL);AK2:=IF(A>0,D8,DRAWNULL); DRAWBAND(AK1,RGB(0,158,0),AK2,RGB(0,158,0)); AB1:=IF(B>0,K8,DRAWNULL);AB2:=IF(B>0,D8,DRAWNULL); DRAWBAND(AB1,RGB(0,208,148),AB2,RGB(0,208,148)); AA:=K4>=D4&&K4>REF(K4,1);
BB:=K4<=D4&&K4<REF(K4,1); BB1:=(K4>=D4&&K4<REF(K4,1))||(K4<=D4&&K4>REF(K4,1)); BB2:=IF(BB1>=0,K4,DRAWNULL);BB3:=IF(BB1>=0,D4,DRAWNULL); DRAWBAND(BB2,RGB(255,255,255),BB3,RGB(255,255,255)); BBK:=IF(BB>0,K4,DRAWNULL);BBD:=IF(BB>0,D4,DRAWNULL); DRAWBAND(BBK,RGB(0,108,255),BBD,RGB(0,108,255)); AAK:=IF(AA>0,K4,DRAWNULL);AAD:=IF(AA>0,D4,DRAWNULL); DRAWBAND(AAK,RGB(255,188,0),AAD,RGB(255,188,0)); STICKLINE(K2>D2 AND K2>REF(K2,1),K2,D2,1,0),COLORRED; STICKLINE(K2<D2 AND K2<REF(K2,1),K2,D2,1,0),COLORYELLOW; 一:K2,LINETHICK2,COLORWHITE; NOTEXT一:IF(K2>REF(K2,1),K2,DRAWNULL),LINETHICK2,COLORRED; NOTEXTK2:IF(K2>REF(K2,1)&&REF(K2,1)>50,K2,DRAWNULL),LINETHICK2,COLORF80088; 二:D2,LINETHICK2,COLORYELLOW; NOTEXT二:IF(D2>REF(D2,1),D2,DRAWNULL),LINETHICK2,COLORRED; NOTEXTD2:IF(D2>REF(D2,1)&&REF(D2,1)>50,D2,DRAWNULL),LINETHICK2,COLORF80088; 三:K1,LINETHICK2,COLORWHITE; NOTEXT三:IF(K1>REF(K1,1),K1,DRAWNULL),LINETHICK2,COLORRED; NOTEXTK1:IF(K1>REF(K1,1)&&REF(K1,1)>50,K1,DRAWNULL),LINETHICK2,COLORF80088; 四:D1,LINETHICK2,COLORYELLOW;
NOTEXTD四:IF(D1>REF(D1,1),D1,DRAWNULL),LINETHICK2,COLORRED; NOTEXTD1:IF(D1>REF(D1,1)&&D1>50,D1,DRAWNULL),LINETHICK2,COLORF80088; JCCOUNT:=BARSLAST(CROSS(K4,D4)&&K4<30); 短二金:=CROSS(K4,D4)&& K4<30&&COUNT(JCCOUNT=2,21)=1; DRAWICON(短二金,K4,1); JCCOUNT1:=BARSLAST(CROSS(K8,D8)&&K8<30); 長二金:=CROSS(K8,D8)&&K8<30&&COUNT(JCCOUNT=2,42)=1; DRAWICON(長二金,K8,1); 五浪底選股:STICKLINE(K1>REF(K1,1)&&K2>REF(K2,1)&&K2<50&&K4<=D4&&K4>K8&&K8<25,0,100,0,1),COLORYELLOW;
小三浪升選股:IF(K1<50&&K1<D1&&K1>REF(K1,1)&&K8>D8&&K8>REF(K8,1),20,0),COLORRED; 七浪底選股:STICKLINE(K2>REF(K2,1)&&K4>REF(K4,1)&&K4<50&&K8<=D8&&K8>K16&&K16<25,0,100,0,1),COLORRED; 大三浪升選股:IF(K2<50&&K2<D2&&K2>REF(K2,1)&&K16>D16&&K16>REF(K16,1),20,0),COLORYELLOW; {OBV:=K1;}
P:=5; {A1:=REF(OBV,P)=HHV(OBV,2*P+1); B1:=FILTER(A1,P); C1:=BACKSET(B1,P+1); D1:=FILTER(C1,P);} {高點} A2:=REF(OBV,P)=LLV(OBV,2*P+1);
B2:=FILTER(A2,P); C2:=BACKSET(B2,P+1); D21:=FILTER(C2,P);{低點} VAR2:=CROSS(D1,0.90);
VAR4:=CROSS(D2,0.90); UU:=BACKSET(CURRBARSCOUNT,BARSLAST(VAR4)+1); VV:=UU>REF(UU,1); WW:=BACKSET(VV,REF(BARSLAST(VAR4),1)+2); XX:=WW>REF(WW,1); DRAWLINE(XX,OBV,VV,OBV,1),COLORWHITE; UU2:=BACKSET(CURRBARSCOUNT,BARSLAST(VAR2)+1); VV2:=UU2>REF(UU2,1); WW2:=BACKSET(VV2,REF(BARSLAST(VAR2),1)+2); XX2:=WW2>REF(WW2,1); DRAWLINE(XX2,OBV,VV2,OBV,1),COLORWHITE; 修改三: RSV16:=(CLOSE-LLV(LOW,144))/(HHV(HIGH,144)-LLV(LOW,144))*100;
RSV166:=SMA(RSV16,21,1); K16:=SMA(RSV166,21,1); D16:=SMA(K16,21,1); RSV8:=(CLOSE-LLV(LOW,72))/(HHV(HIGH,72)-LLV(LOW,72))*100; RSV88:=SMA(RSV8,13,1); K8:=SMA(RSV88,13,1); D8:=SMA(K8,13,1); RSV4:=(CLOSE-LLV(LOW,36))/(HHV(HIGH,36)-LLV(LOW,36))*100; RSV44:=SMA(RSV4,8,1); K4:=SMA(RSV44,8,1); D4:=SMA(K4,8,1); RSV2:=(CLOSE-LLV(LOW,18))/(HHV(HIGH,18)-LLV(LOW,18))*100; RSV22:=SMA(RSV2,3,1); K2:=SMA(RSV2,4,1); D2:=SMA(K2,4,1); RSV1:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100; RSV11:=SMA(RSV1,3,1); K1:=SMA(RSV1,3,1); D1:=SMA(K1,3,1); A0:=K16>=D16&&K16>REF(K16,1); B0:=K16<=D16&&K16<REF(K16,1); B10:=(K16>=D16&&K16<REF(K16,1))||(K16<=D16&&K16>REF(K16,1)); B11:=IF(B10>=0,K16,DRAWNULL);B12:=IF(B10>=0,D16,DRAWNULL); DRAWBAND(B11,RGB(255,255,255),B12,RGB(255,255,255)); A01:=IF(A0>0,K16,DRAWNULL);A02:=IF(A0>0,D16,DRAWNULL); DRAWBAND(A01,RGB(168,128,255),A02,RGB(168,128,255)); B01:=IF(B0>0,K16,DRAWNULL);B02:=IF(B0>0,D16,DRAWNULL); DRAWBAND(B01,RGB(28,128,118),B02,RGB(28,128,118)); A:=K8>=D8&&K8>REF(K8,1); B:=K8<=D8&&K8<REF(K8,1); B1:=(K8>=D8&&K8<REF(K8,1))||(K8<=D8&&K8>REF(K8,1)); BA1:=IF(B1>=0,K8,DRAWNULL);BA2:=IF(B1>=0,D8,DRAWNULL); DRAWBAND(BA1,RGB(255,255,255),BA2,RGB(255,255,255)); AK1:=IF(A>0,K8,DRAWNULL);AK2:=IF(A>0,D8,DRAWNULL); DRAWBAND(AK1,RGB(0,158,0),AK2,RGB(0,158,0)); AB1:=IF(B>0,K8,DRAWNULL);AB2:=IF(B>0,D8,DRAWNULL); DRAWBAND(AB1,RGB(0,208,148),AB2,RGB(0,208,148)); AA:=K4>=D4&&K4>REF(K4,1);
BB:=K4<=D4&&K4<REF(K4,1); BB1:=(K4>=D4&&K4<REF(K4,1))||(K4<=D4&&K4>REF(K4,1)); BB2:=IF(BB1>=0,K4,DRAWNULL);BB3:=IF(BB1>=0,D4,DRAWNULL); DRAWBAND(BB2,RGB(255,255,255),BB3,RGB(255,255,255)); BBK:=IF(BB>0,K4,DRAWNULL);BBD:=IF(BB>0,D4,DRAWNULL); DRAWBAND(BBK,RGB(0,108,255),BBD,RGB(0,108,255)); AAK:=IF(AA>0,K4,DRAWNULL);AAD:=IF(AA>0,D4,DRAWNULL); DRAWBAND(AAK,RGB(168,188,0),AAD,RGB(168,188,0)); STICKLINE(K2>D2&&K2>REF(K2,1),K2,D2,1,1),COLORRED; STICKLINE(K2<D2&&K2<REF(K2,1),K2,D2,1,1),COLORYELLOW; 一:K2,LINETHICK2,COLORWHITE; NOTEXT一:IF(K2>REF(K2,1),K2,DRAWNULL),LINETHICK2,COLORRED; NOTEXTK2:IF(K2>REF(K2,1)&&REF(K2,1)>50,K2,DRAWNULL),LINETHICK2,COLORF80088; 二:D2,LINETHICK2,COLORGREEN; NOTEXT二:IF(D2>REF(D2,1),D2,DRAWNULL),LINETHICK2,COLORRED; NOTEXTD2:IF(D2>REF(D2,1)&&REF(D2,1)>50,D2,DRAWNULL),LINETHICK2,COLORF80088; 三:K1,LINETHICK2,COLORWHITE; NOTEXT三:IF(K1>REF(K1,1),K1,DRAWNULL),LINETHICK2,COLORRED; NOTEXTK1:IF(K1>REF(K1,1)&&REF(K1,1)>50,K1,DRAWNULL),LINETHICK2,COLORF80088; 四:D1,LINETHICK2,COLORYELLOW; NOTEXTD四:IF(D1>REF(D1,1),D1,DRAWNULL),LINETHICK2,COLORRED; NOTEXTD1:IF(D1>REF(D1,1)&&D1>50,D1,DRAWNULL),LINETHICK2,COLORF80088; JCCOUNT:=BARSLAST(CROSS(K4,D4)&&K4<30); 短二金:=CROSS(K4,D4)&& K4<30&&COUNT(JCCOUNT=2,21)=1; DRAWICON(短二金,K4,1); JCCOUNT1:=BARSLAST(CROSS(K8,D8)&&K8<30); 長二金:=CROSS(K8,D8)&&K8<30&&COUNT(JCCOUNT=2,42)=1; DRAWICON(長二金,K8,1); 五浪底選股:STICKLINE(K1>REF(K1,1)&&K2>REF(K2,1)&&K2<50&&K4<=D4&&K4>K8&&K8<25,0,100,0,1),COLORYELLOW;
小三浪升選股:IF(K1<50&&K1<D1&&K1>REF(K1,1)&&K8>D8&&K8>REF(K8,1),20,0),COLORRED; 七浪底選股:STICKLINE(K2>REF(K2,1)&&K4>REF(K4,1)&&K4<50&&K8<=D8&&K8>K16&&K16<25,0,100,0,1),COLORRED; 大三浪升選股:IF(K2<50&&K2<D2&&K2>REF(K2,1)&&K16>D16&&K16>REF(K16,1),20,0),COLORYELLOW; {OBV:=K1;}
P:=5; {A1:=REF(OBV,P)=HHV(OBV,2*P+1); B1:=FILTER(A1,P); C1:=BACKSET(B1,P+1); D1:=FILTER(C1,P);} {高點} A2:=REF(OBV,P)=LLV(OBV,2*P+1);
B2:=FILTER(A2,P); C2:=BACKSET(B2,P+1); D21:=FILTER(C2,P);{低點} VAR2:=CROSS(D1,0.90);
VAR4:=CROSS(D2,0.90); UU:=BACKSET(CURRBARSCOUNT,BARSLAST(VAR4)+1); VV:=UU>REF(UU,1); WW:=BACKSET(VV,REF(BARSLAST(VAR4),1)+2); XX:=WW>REF(WW,1); DRAWLINE(XX,OBV,VV,OBV,1),COLORWHITE; UU2:=BACKSET(CURRBARSCOUNT,BARSLAST(VAR2)+1); VV2:=UU2>REF(UU2,1); WW2:=BACKSET(VV2,REF(BARSLAST(VAR2),1)+2); XX2:=WW2>REF(WW2,1); DRAWLINE(XX2,OBV,VV2,OBV,1),COLORWHITE; |
|