月K:="KDJ.K#MONTH"COLOR0080FF;
月D:="KDJ.D#MONTH";
周K:="KDJ.K#WEEK";
周D:="KDJ.D#WEEK";
日K:="KD.K";
日D:="KD.D";
日金叉:IF(CROSS(日K,日D),5,-9),COLORWHITE;
周金叉:IF(CROSS(周K,周D),12,-9),COLORRED;
月金叉:IF(CROSS(月K,月D),15,-9),COLOR0080FF;
周死叉:IF(CROSS(周D,周K),18,-9),COLORFFFF00;
月死叉:IF(CROSS(月D,月K),22,-9),COLORGREEN;
STICKLINE(CROSS(日K,日D),-3,-9,1.5,0),COLORFFFFFF;
STICKLINE(CROSS(周K,周D),3,-3,1.5,0),COLOR0000FF;
DIFF:=EMA(CLOSE,10) - EMA(CLOSE,22);
DEA :=EMA(DIFF,7.5);{
MACD :=2*(DIFF-DEA);}
AA1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
{ 爱约股_通达信股票指标公式}
BB1:=(REF(L,AA1+1)>L OR REF(C,AA1+1)>C) AND REF(L,DIFF)>REF((L,DIFF),AA1+1) AND CROSS(DIFF,DEA);{底背离}
AAA2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
BBB1:=(REF(C,AAA2+1)<C OR REF(H,AAA2+1)<H) AND REF((H,DIFF),AAA2+1)>(H,DIFF) AND CROSS(DEA,DIFF);{顶背离}
AA2:=BARSLAST(REF(CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3)),1));
BB2:=REF(C,AA2+1)>C AND REF("KDJ.K"(9,3,3),AA2+1)<"KDJ.K"(9,3,3) AND CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3));
C2:=BARSLAST(REF(CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3)),1));
D2:=REF(C,C2+1)<C AND REF("KDJ.K"(9,3,3),C2+1)>"KDJ.K"(9,3,3) AND CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3));
AA3:=BARSLAST(REF(CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24)),1));
BB3:=REF(C,AA3+1)>C AND REF("RSI.RSI1"(6,12,24),AA3+1)<"RSI.RSI1"(6,12,24) AND CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24));
C3:=BARSLAST(REF(CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24)),1));
D3:=REF(C,C3+1)<C AND REF("RSI.RSI1"(6,12,24),C3+1)>"RSI.RSI1"(6,12,24) AND CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24));
MACD底背:IF(BB1>0,0,0),COLOR208FFF;
MACD顶背:IF(BBB1>0,0,0),COLOR00FF00;
KDJ底背:IF(BB2>0,0,0),COLOR0000FF;
KDJ顶背:IF(D2>0,0,0),COLORFFCC66;
RSI底背:IF(BB3>0,0,0),COLORFF9F00;
RSI顶背:IF(D3>0,0,0),COLORFFFFFF;
STICKLINE(BB1>0,45,50,3,0),COLOR208FFF;
STICKLINE(BBB1>0,55,50,3,0),COLOR00FF00;
STICKLINE(BB2>0,45,50,2.5,0),COLOR0000FF;
STICKLINE(D2>0,55,50,2.5,0),COLORFFCC66;
STICKLINE(BB3>0,45,50,1.5,0),COLORFF9F00;
STICKLINE(D3>0,55,50,1.5,0),COLORWHITE;
AS1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
底背离:REF(DIFF,AS1+1)<DIFF AND REF(DEA,AS1+1)<DEA AND REF(L,AS1+1)>L AND CROSS(DIFF,DEA),NODRAW,COLOR00FF00;
STICKLINE(底背离,45,50,1,0),COLOR00FFFF;
106,COLORFFFFFF;
顶:82,COLORFFFF00,LINETHICK1;
顶A:92,COLOR999599,LINETHICK5;
低:1,COLOR208FFF,LINETHICK0;
低A:9,COLORFFF000,LINETHICK1;
50,COLOR888888,DOTLINE,LINETHICK1;
0,COLORFF00FF;
JQZD:=LLV(LOW,9);
JQZG:=HHV(HIGH,9);
RSV:=EMA((CLOSE-JQZD)/(JQZG-JQZD)*100,3);
K:EMA(RSV,3);
D:MA(K,3);
DRAWBAND(K,RGB(155,77,77),D,RGB(77,188,77));
DRAWTEXT(ISLASTBAR AND K>REF(K,1),K,'▲'),COLORFFAAFF;
DRAWTEXT(ISLASTBAR AND K<REF(K,1),K,'▼'),COLORFFAAFF;
LOWV:=EMA(LLV(LOW,34),3);
HIGHV:=EMA(HHV(HIGH,34),3);
RSVB:=EMA((CLOSE-LOWV)/(HIGHV-LOWV)*100,3);
KB:=SMA(RSVB,10,1);
DB:=SMA(KB,8,1);
JB:3*KB-2*DB,COLOR00FFFF,LINETHICK1,DOTLINE;
DRAWTEXT(ISLASTBAR AND JB>REF(JB,1),JB,'▲'),COLOR00FFFF;
DRAWTEXT(ISLASTBAR AND JB<REF(JB,1),JB,'▼'),COLOR00FFFF;
周JA:"SKDJ.K#WEEK"COLORRED;
QA1:=EMA(LLV(LOW,9),3);
QA2:=EMA(HHV(HIGH,9),3);
QA3:=EMA(C,2);
RSVA:=EMA((QA3-QA1)/(QA2-QA1)*100,3);
KA:=SMA(RSVA,3,1);
DA:=SMA(KA,3,1);
JA:=3*KA-2*DA;
LC := REF(CLOSE,1);
RSI1:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;
TYPP:=(HIGH+LOW+CLOSE)/3;
CCI20:=(TYPP-MA(TYPP,14))/(0.015*AVEDEV(TYPP,14));
STICKLINE(CCI20>=150,101,98,1.5,0) ,COLOR508FFF;
STICKLINE(RSI1>76,104,102,1.5,0) ,COLORFFFF00;
STICKLINE(JA>90,106,104,1.5,0) ,COLOR0000FF;
RSI5:=((SMA(MAX((CLOSE - LC),0),5,1) / SMA(ABS((CLOSE - LC)),5,1)) * 100);
R:=SUM(MAX(MAX((HIGH - LOW),ABS((HIGH - REF(CLOSE,1)))),ABS((LOW - REF(CLOSE,1)))),10);
HD:=(HIGH - REF(HIGH,1));
LD:=(REF(LOW,1) - LOW);
DMP:=SUM(IF(((HD > 0) AND (HD > LD)),HD,0),10);
DMM:=SUM(IF(((LD > 0) AND (LD > HD)),LD,0),10);
PDI:=((DMP * 100) / R);
MDI:=((DMM * 100) / R);
ADX:=MA(((ABS((MDI - PDI)) / (MDI + PDI)) * 100),5);
AV:=(RSI5 + ADX);
DXR:=(((ADX + REF(ADX,5)) / 2) + RSI5);
WR10:=((100 * (HHV(HIGH,10) - CLOSE)) / (HHV(HIGH,10) - LLV(LOW,10)));
NEWVOL:=(RSI5 - WR10);
JDDB:=(AV + NEWVOL);
STICKLINE((JDDB < 0),9,13,2.5,0),COLORRED;
QSX:=LLV(JDDB,1);
STICKLINE((QSX >230 ),94,90,2.5,0),COLORGREEN;