当前位置: 网站首页 > 股票软件公式 > 通达信公式 > 文章 当前位置: 通达信公式 > 文章

通达信源码精选:多空转换KDJ,新MACD,变色K线

点击: 次    来源:顶尖财经    作者:股市狙击 - 小 + 大

1、多空转换KDJ

{多空转换KDJ}

 
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(J<0,J,DRAWNULL),COLORGREEN,LINETHICK4;
IF(K>90,K,DRAWNULL),COLOR0000FF,LINETHICK4;
IF(K<REF(K,1),K,DRAWNULL),COLORGREEN,LINETHICK2;
IF(D<REF(D,1),D,DRAWNULL),COLORGREEN,LINETHICK2;
IF(J<REF(J,1),J,DRAWNULL),COLORFFFF00,LINETHICK2;
IF(K>REF(K,1),K,DRAWNULL),COLORRED,LINETHICK2;
IF(D>REF(D,1),D,DRAWNULL),COLORRED,LINETHICK2;
IF(J>REF(J,1),J,DRAWNULL),COLORFF00FF,LINETHICK2;
(K-D)*2,COLORSTICK;
STICKLINE((K-D)*2>0,0,(K-D)*2,3,0),COLORRED;
STICKLINE((K-D)*2<0,0,(K-D)*2,3,0),COLORGREEN;
STICKLINE((K-D)*2<0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,3,0),COLOR007700;
STICKLINE((K-D)*2<0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,3,0),COLOR005500;
STICKLINE((K-D)*2<0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,3,0),COLOR006600;
STICKLINE((K-D)*2<0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,3,0),COLOR007700;
STICKLINE((K-D)*2=0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,3,0 ),COLORFF66AA;
STICKLINE((K-D)*2>=0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,3,0),COLORFF66AA;
STICKLINE((K-D)*2>=0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,3,0 ),COLORFF11FF;
STICKLINE((K-D)*2>=0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,3,0 ),COLORFF44FF;
STICKLINE((K-D)*2>=0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,3,0 ),COLORFF66FF;
{STICKLINE(1,64,67,3,1),COLORWHITE;}
 
 
STICKLINE((K-D)*2>0 AND (K-D)*2>REF((K-D)*2,1),(K-D)*2,0,3,0),COLORRED;
STICKLINE((K-D)*2>0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,3,0),COLOR008080;
STICKLINE((K-D)*2<0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,3,0),COLOR00FF00;
STICKLINE((K-D)*2<0 AND (K-D)*2>REF((K-D)*2,1),(K-D)*2,0,3,0),COLORFFFFFF;
 
STICKLINE((K-D)*2<0 AND (K-D)*2>REF((K-D)*2,1),(K-D)*2,0,3,0 ),COLORFFAA00;
STICKLINE((K-D)*2<0 AND (K-D)*2>REF((K-D)*2,1),(K-D)*2,0,3.3 ,0 ),COLORFFBB11;
STICKLINE((K-D)*2<0 AND (K-D)*2>REF((K-D)*2,1),(K-D)*2,0,2.2,0 ),COLORFFCC22;
STICKLINE((K-D)*2<0 AND (K-D)*2>REF((K-D)*2,1),(K-D)*2,0,1.65 ,0 ),COLORFFDD33;
STICKLINE((K-D)*2<0 AND (K-D)*2>REF((K-D)*2,1),(K-D)*2,0,1.1 ,0 ),COLORFFEE44;
STICKLINE((K-D)*2<0 AND (K-D)*2>REF((K-D)*2,1),(K-D)*2,0,0.55 ,0 ),COLORFFFF55;
 
STICKLINE((K-D)*2<0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,0,0 ),COLOR00E600;
STICKLINE((K-D)*2<0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,3.5,0 ),COLOR007700;
STICKLINE((K-D)*2<0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,2.7,0 ),COLOR008E00;
STICKLINE((K-D)*2<0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,2.1,0 ),COLOR009900;
STICKLINE((K-D)*2<0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,1.5,0 ),COLOR00B500;
STICKLINE((K-D)*2<0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,0.9,0 ),COLOR00D500;
STICKLINE((K-D)*2<0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,0.3,0 ),COLOR00E600;
STICKLINE((K-D)*2<0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,0,1 ),COLOR00E600;
STICKLINE((K-D)*2>0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,3.5,0),COLOR0044AA;
STICKLINE((K-D)*2>0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,3.4,0),COLOR0055AA;
STICKLINE((K-D)*2>0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,3.2,0),COLOR0066BB;
STICKLINE((K-D)*2>0 AND(K-D)*2<REF((K-D)*2,1),(K-D)*2,0,3.0,0),COLOR0077BB;
STICKLINE((K-D)*2>0 AND(K-D)*2<REF((K-D)*2,1),(K-D)*2,0,2.7,0),COLOR0088CC;
STICKLINE((K-D)*2>0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,2.4,0),COLOR0099CC;
STICKLINE((K-D)*2>0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,2.1,0),COLOR00AADD;
STICKLINE((K-D)*2>0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,1.8,0),COLOR00BBDD;
STICKLINE((K-D)*2>0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,1.4,0),COLOR00CCEE;
STICKLINE((K-D)*2>0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,1.0,0),COLOR00DDEE;
STICKLINE((K-D)*2>0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,0.6,0),COLOR00EEEE;
STICKLINE((K-D)*2>0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,0.2,0),COLOR00F0F3;
STICKLINE((K-D)*2>0 AND (K-D)*2<REF((K-D)*2,1),(K-D)*2,0,0.05,0),COLOR00F6F3;
STICKLINE((K-D)*2>0 AND (K-D)*2>REF((K-D)*2,1),(K-D)*2,0,3.5,0) ,COLOR00005A;
STICKLINE((K-D)*2>0 AND (K-D)*2>REF((K-D)*2,1),(K-D)*2,0,3.4,0) ,COLOR00006A;
STICKLINE((K-D)*2>0 AND (K-D)*2>REF((K-D)*2,1),(K-D)*2,0,3.3,0) ,COLOR00007A;
STICKLINE((K-D)*2>0 AND (K-D)*2>REF((K-D)*2,1),(K-D)*2,0,3.2,0) ,COLOR00008A;
STICKLINE((K-D)*2>0 AND (K-D)*2>REF((K-D)*2,1),(K-D)*2,0,3.1,0) ,COLOR00009A;
STICKLINE((K-D)*2>0 AND(K-D)*2>REF((K-D)*2,1),(K-D)*2,0,2.8,0) ,COLOR0000AA;
STICKLINE((K-D)*2>0 AND (K-D)*2>REF((K-D)*2,1),(K-D)*2,0,2.5,0) ,COLOR0000BA;
STICKLINE((K-D)*2>0 AND (K-D)*2>REF((K-D)*2,1),(K-D)*2,0,2.1,0) ,COLOR0000CA;
STICKLINE((K-D)*2>0 AND (K-D)*2>REF((K-D)*2,1),(K-D)*2,0,1.7,0) ,COLOR0000DA;
STICKLINE((K-D)*2>0 AND (K-D)*2>REF((K-D)*2,1),(K-D)*2,0,1.2,0) ,COLOR0000EA;
STICKLINE((K-D)*2>0 AND (K-D)*2>REF((K-D)*2,1),(K-D)*2,0,0.7,0) ,COLOR0000F5;
STICKLINE((K-D)*2>0 AND (K-D)*2>REF((K-D)*2,1),(K-D)*2,0,0.2,0) ,COLOR0000FC;
STICKLINE((K-D)*2>0 AND (K-D)*2>REF((K-D)*2,1),(K-D)*2,0,0.05,0),COLOR0000FF;




2、新MACD,有信号N次金叉,顶底背离N底

{新MACD 有信号:金叉,二次金叉,三次金叉,四次金叉,五次金叉,六次金叉,七次金叉,八次金叉,九次金叉,黄金底,白金底,钻石底,金钻底,底背离,顶背离,三全底}

DIFF:EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:EMA(DIFF,9);
MACD:2*(DIFF-DEA),COLORSTICK;
STICKLINE(MACD<REF(MACD,1) AND MACD>0,0,MACD,0,0),COLORGREEN;
STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,0,0),COLORMAGENTA;
JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=1,21)=1;
STICKLINE(金叉,0,0.1,5,0),COLOR0000FF;
DRAWTEXT(金叉,-0.095,'金叉'),COLOR0000FF;
二金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;
STICKLINE(二金叉,0,0.15,5,0),COLORLIRED;
DRAWTEXT(二金叉,0.23,'二次金叉'),COLORLIRED;
三金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=3,28)=1;
STICKLINE(三金叉,0,0.2,5,0),COLORLIGREEN;
DRAWTEXT(三金叉,0.28,'三次金叉'),COLORLIGREEN;
四金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=4,28)=1;
STICKLINE(四金叉,0,0.25,5,0),COLORCYAN;
DRAWTEXT(四金叉,0.33,'四次金叉'),COLORCYAN;
五金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=5,33)=1;
STICKLINE(五金叉,0,0.3,5,0),COLORBLUE;
DRAWTEXT(五金叉,0.37,'五次金叉'),COLORBLUE;
六金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=6,33)=1;
STICKLINE(六金叉,0,0.35,5,0),COLORYELLOW;
DRAWTEXT(六金叉,0.0.7,'黄金底'),COLORYELLOW;
DRAWTEXT(六金叉,0.42,'六次金叉'),COLORYELLOW;
七金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=7,33)=1;
STICKLINE(七金叉,0,0.4,5,0),COLORWHITE;
DRAWTEXT(七金叉,0.0.88,'白金底'),COLORWHITE;
DRAWTEXT(七金叉,0.47,'七次金叉'),COLORWHITE;
八金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=8,33)=1;
STICKLINE(八金叉,0,0.5,5,0),COLORMAGENTA;
DRAWTEXT(八金叉,0.0.8,'钻石底'),COLORMAGENTA;
DRAWTEXT(八金叉,0.57,'八次金叉'),COLORMAGENTA;
九金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=9,33)=1;
STICKLINE(九金叉,0,0.55,5,0),COLORRED;
DRAWTEXT(九金叉,0.0.8,'金钻底'),COLORRED;
DRAWTEXT(九金叉,0.6,'九次金叉'),COLORRED;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
底背离:=(REF(L,A1+1)>L OR REF(C,A1+1)>C) AND (L,DIFF)>REF((L,DIFF),A1+1) AND CROSS(DIFF,DEA);
STICKLINE(底背离,0,-0.1,5,0),COLORRED;
DRAWTEXT(底背离,DEA,'底背离')COLORRED;
DRAWLINE(A1=0,DEA,底背离,DEA,0),COLOR0000FF,LINETHICK3;
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离:=(REF(C,A2+1)<C OR REF(H,A2+1)<H) AND REF((H,DIFF),A2+1)>(H,DIFF) AND CROSS(DEA,DIFF);
DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,LINETHICK3;
STICKLINE(顶背离,0,0.1,5,0),COLORGREEN;
DRAWTEXT(顶背离,DEA,'顶背离')COLORGREEN;
DRAWTEXT(CROSS(DIFF,DEA) AND 二金叉 AND 底背离,0.3,'三全底'),COLOR0000FF;
IF(DIFF>DEA,DIFF,DRAWNULL),COLORWHITE,LINETHICK2;
IF(DEA>REF(DEA,1) AND DIFF>DEA,DEA,DRAWNULL),COLORYELLOW,LINETHICK2;
{股民学院 www.58188.com 整理}



3、变色K线 趋势支撑压力点,红绿K线 变色彩带

变色K 趋势支撑压力点,红绿K线 变色彩带
公式很简单,没有未来函数,信号不会漂移。

{变色趋势K支压}
SJ:=1;
{+4天上方时间为准}
VAR1:=EMA(CLOSE,15)*SJ;
VAR2:=EMA(CLOSE,60)*SJ;
VAR3:=(CLOSE*SJ-VAR2*SJ)*2/(60+1)+VAR2;
生命线:VAR3*SJ,LINETHICK2, COLORYELLOW;
HX:=HHV(HIGH,3);
LX:=LLV(LOW,3);
H1:=IF(HX<REF(HX,1)&&HX<REF(HX,2)&&HX<REF(HX,4)&&LX<REF(LX,1)&&LX<REF(LX,3)&&LX<REF(LX,5)&&OPEN>CLOSE&&(HHV(OPEN,0)-CLOSE)>0,REF(HX,4),0);
L1:=IF(LX>REF(LX,1)&&LX>REF(LX,3)&&LX>REF(LX,5)&&HX>REF(HX,1)&&HX>REF(HX,2)&&HX>REF(HX,4)&&OPEN<CLOSE&&(CLOSE-LLV(OPEN,0))>0,REF(LX,4),0);
H2:=VALUEWHEN(H1>0,H1);
L2:=VALUEWHEN(L1>0,L1);
K1:=IF(CLOSE>H2,-3,IF(CLOSE<L2,1,0));
K2:=VALUEWHEN(K1<>0,K1);
G:=IF(K2=1,H2,L2);
G1:=VALUEWHEN(ISLASTBAR,G);
TMP:=K2;
W1:=K2;
W2:=OPEN-CLOSE;
HT:=IF(OPEN>CLOSE,OPEN,CLOSE);
LT:=IF(OPEN<CLOSE,OPEN,CLOSE);
STICKLINE(W1=1,HIGH,HT,0,0),COLORCYAN;
STICKLINE(W1=1,LOW,LT,0,0),COLORCYAN;
STICKLINE(W1=-3,HIGH,HT,0,0),COLORRED;
STICKLINE(W1=-3,LOW,LT,0,0),COLORRED;
STICKLINE(W1>0,OPEN,CLOSE,3,1),COLORCYAN;
STICKLINE(W1<=0,OPEN,CLOSE,3,1),COLORRED;
STICKLINE(W2>0&&W1<=0,OPEN,CLOSE,3,0),COLORRED;
STICKLINE(W2>0&&W1>0,OPEN,CLOSE,3,0),COLORCYAN;
A:=WMA(HIGH,30);
B:=WMA(LOW,30);
A1:=WMA(HIGH,150),LINETHICK2;
B1:=WMA(LOW,150);
S1:=CROSS(CLOSE,WMA(HIGH,150));
X1:=CROSS(WMA(LOW,150),CLOSE);
WS1:=BARSLAST(S1)+1;
WX1:=BARSLAST(X1)+1;
SS1:=CROSS(SUM(S1,WX1),0.5);
XX1:=CROSS(SUM(X1,WS1),0.5);
S:=CROSS(CLOSE,WMA(HIGH,30));
X:=CROSS(WMA(LOW,30),CLOSE),LINETHICK2;
WS:=BARSLAST(S)+1,LINETHICK2;
WX:=BARSLAST(X)+1,LINETHICK2;
SS:=CROSS(SUM(S,WX),0.5);
XX:=CROSS(SUM(X,WS),0.5);
{STICKLINE(CLOSE>WMA(HIGH,30),WMA(HIGH,30),WMA(LOW,30),3,1),COLORMAGENTA;
STICKLINE(CLOSE<WMA(LOW,30),WMA(LOW,30),WMA(HIGH,30),3,1),COLORGREEN;}
STICKLINE(CLOSE>WMA(HIGH,150),WMA(HIGH,150),WMA(LOW,150),3,1),COLORRED;
STICKLINE(CLOSE<WMA(LOW,150),WMA(LOW,150),WMA(HIGH,150),3,1),COLORBLUE;
IF(CLOSE>WMA(HIGH,150),WMA(HIGH,150),DRAWNULL),COLORRED;
IF(CLOSE<WMA(HIGH,150),WMA(HIGH,150),DRAWNULL),COLORBLUE;
IF(CLOSE>WMA(LOW,150),WMA(LOW,150),DRAWNULL),COLORRED;
IF(CLOSE<WMA(LOW,150),WMA(LOW,150),DRAWNULL),COLORBLUE;

上一篇:通达信源码精选:变色换手柱,专用跟庄指标,牛气冲天主图

下一篇:通达信源码精选:基本面主图,精准BS,分时趋势