【通达信】核心指标(画线、下档线、明日阻力、明日支撑)-指标公式源码
N:=5;N1:=3;
快:MA(CLOSE,3),POINTDOT,COLORYELLOW,LINETHICK1; {画线 TDX N:1,100,8 K:0,2,1 P:0,1,0} {N:=8;N1:=5;} K:=0,2,1; P:=0,1,0; ZGD:=HHV(H,60); ZGD2:=CONST(ZGD); ZDD:=LLV(L,60); ZDD2:=CONST(ZDD); GJ:=(C+H+L+O)/4;
明日阻力:=L+(GJ-L)+(C-L); 明日支撑:=L+(C-GJ); KOH:=L>REF(H,1); KOL:=H HIF:=L>REF(H,BARSLAST(KOH)+1); NHIF:=L<=REF(H,BARSLAST(KOH)+1); LIF:=H=REF(L,BARSLAST(KOL)+1); 下档线:=(((CLOSE - LLV(LOW,13)) / (HHV(HIGH,13) - LLV(LOW,13))) * 200); RRRSV:=SMA(下档线,3,1); KKK:=SMA(RRRSV,3,1); DDDDD:=((3 * RRRSV) - (2 * KKK)); JJ12:=(((CLOSE - LLV(LOW,55)) / (HHV(HIGH,55) - LLV(LOW,55))) * 200); RSV24:=SMA(JJ12,3,1); K24:=SMA(RSV24,3,1); D24:=((3 * RSV24) - (2 * K24)); 压力 2:=IF(CROSS(D24,DDDDD),HIGH,REF(HIGH,BARSLAST(CROSS(D24,DDDDD)))),COLORFFFFFF; 底部:=LLV(HIGH,30),COLOR00FF00; AA:=REF(H,N)=HHV(H,2*N+1); AA1:=REF(L,N)=LLV(L,2*N+1); QY:=BACKSET(AA,N+1); QY1:=BACKSET(AA1,N+1); CC:=FILTER(QY,N) AND H=HHV(H,N+1); CC1:=FILTER(QY1,N) AND L=LLV(L,N+1); DDD:=BARSLAST(CC); DD1:=BARSLAST(CC1); GDTS:=IF(CC,CURRBARSCOUNT,0); DDTS:=IF(CC1,CURRBARSCOUNT,0); DINGBUTS:=IF(DDD,REF(GDTS,DDD),GDTS); DDTS1:=IF(DD1,REF(DDTS,DD1),DDTS); GDCS1:=CONST(DINGBUTS); DDCS1:=CONST(DDTS1); GDCS13:=CONST(REF(HIGH,GDCS1-1)); DDCS13:=CONST(REF(L,DDCS1-1)); DINGBUTS1:=REF(DINGBUTS,DDD+1); DDTS2:=REF(DDTS1,DD1+1); GDCS2:=CONST(DINGBUTS1); DDCS2:=CONST(DDTS2); GDCS23:=CONST(REF(HIGH,DINGBUTS1-1)); DDCS23:=CONST(REF(L,DDTS2-1)); XG1:=BACKSET(ISLASTBAR,GDCS1); XD1:=BACKSET(ISLASTBAR,DDCS1); XG2:=BACKSET(ISLASTBAR,DINGBUTS1); XD2:=BACKSET(ISLASTBAR,DDTS2); XDD:=IF(DDCS13<=DDCS23,XD1,XD2); BCG:=SUM(XG1,0); BCD:=SUM(XDD,0); 顶:=IF(ISLASTBAR,压力2,DRAWNULL),NODRAW; 底:=IF(ISLASTBAR,底部,DRAWNULL),NODRAW; AA05:=MA(C,5),COLOR0099CC; 五日乖离率:=(C-AA05)/AA05*100; BB05:=ATAN((AA05/REF(AA05,1)-1)*100)*180/3.1416; 速度5:=SMA(EMA((AA05-REF(AA05,1))/REF(AA05,1),3)*100,3,1); 加速度5:=EMA((速度5-REF(速度5,1)),3),NODRAW; AA10:=MA(C,10); AA20:=MA(C,20); BB10:=ATAN((AA10/REF(AA10,1)-1)*100)*180/3.1416; AA30:=MA(C,30); JJ1:=FORCAST((3*C+2*REF(C,1)+1*REF(C,2))/(3+2+1),20); JJ2:=FORCAST((15*C+14*REF(C,1)+13*REF(C,2)+12*REF(C,3)+11*REF(C,4)+10*REF(C,5)+9*REF(C,6)+8*REF(C,7)+7*REF(C,8)+6*REF(C,9)+5*REF(C,10)+4*REF(C,11)+3*REF(C,12)+2*REF(C,13)+1*REF(C,14))/(15+14+13+12+11+10+9+8+7+6+5+4+3+2+1),20); XJ3:=FILTER(CROSS(JJ1,JJ2),3); XJ4:=FILTER(CROSS(JJ2,JJ1),3); {阻:=REF(明日阻力 , 1),NODRAW,COLORMAGENTA; 支:=REF(明日支撑 , 1),NODRAW,COLORGREEN;} YJL:=JJ1,COLORLIGRAY,LINETHICK1; 若:FORCAST(CLOSE,20),COLORRED,LINETHICK1; VARJL:=((VOL)*(OPEN + CLOSE + HIGH + LOW))/(4); 飞:FORCAST((MA(VARJL,1))/(EMA(VOL,1)),20),COLORLIGREEN,LINETHICK1; YJ:=FORCAST(MA(CLOSE,12),20); YJD:=YJ - JJ1 - YJ; {VAR92:=1; VAR98:=MAX(MAX((HIGH - LOW),ABS((REF(CLOSE,1) - HIGH))),ABS((REF(CLOSE,1) - LOW))); VAR99:=MA(VAR98,13); VAR910:=(REF(CLOSE,1) - REF(VAR99,1)); {百:(HHV(VAR910,7) * VAR92),,COLORFF9800,LINETHICK2,; 闻:(HHV(VAR910,12) * VAR92),COLORWHITE,LINETHICK1;} TR:= MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW)); ATR:=MA(TR,13); DVAR1:=REF(CLOSE,1)-REF(ATR,1); {百:=HHV(DVAR1,3),COLORGRAY,LINETHICK1;} 百:HHV(DVAR1,7),COLORDDAADD,LINETHICK2; 闻:HHV(DVAR1,12),COLORWHITE,LINETHICK1; {强:=MA(CLOSE,13)+2*STD(CLOSE,13),COLORBROWN,LINETHICK1;} 天:PEAK(CLOSE,10,1)*0.98,COLORFF9800,LINETHICK2; 地:TROUGH(CLOSE,10,1)*1.02,COLORFF9500,LINETHICK2; {弱:=MA(CLOSE,13)-2*STD(CLOSE,13),,COLORBROWN,LINETHICK1;} A01:=REF(C,10)=HHV(C,2*10+1); B01:=FILTER(A01,10); C01:=BACKSET(B01,10+1); HD:=FILTER(C01,10); A02:=REF(C,10)=LLV(C,2*10+1); B02:=FILTER(A02,10); C02:=BACKSET(B02,10+1); LD:=FILTER(C02,10); 高:REF(H,BARSLAST(HD)),POINTDOT,COLORRED,LINETHICK2; 低:REF(L,BARSLAST(LD)),POINTDOT,COLORGREEN,LINETHICK2; 半:(高+低)/2,,POINTDOT,COLORCE9D8E,LINETHICK4; {STICKLINE(半,半,半,9,1),COLORCE9D8E,LINETHICK1;} ㈠:DRAWLINE(CURRBARSCOUNT=GDCS2,H,CURRBARSCOUNT=GDCS1,H,1) , COLORE6289F,LINETHICK1; ㈡:DRAWLINE(CURRBARSCOUNT=DDCS2,L,CURRBARSCOUNT=DDCS1,L,1), COLORE6289F,LINETHICK1; 高1:=CONST(MAX(MAX(MAX(ZGD2,㈠),GDCS13),GDCS23)); 低1:=CONST(MIN(MIN(MIN(ZDD2,DDCS23),DDCS13),㈡)); {DRAWBAND(高1,RGB(100,100,100),低1,RGB(100,100,100));} {DRAWBAND(㈠,RGB(00,00,100),㈡,RGB(00,00,100)),;} 金H:=IF(CLOSE>200,SUM(H*VOL,BCG)/SUM(VOL,BCG),SUM(AMOUNT,BCG)/ SUM(V,BCG)/100*SUM(H,BCG)/SUM(C,BCG)); 金L:=IF(CLOSE>200,SUM(L*VOL,BCD)/SUM(VOL,BCD),SUM(AMOUNT,BCD)/ SUM(V,BCD)/100*SUM(L,BCD)/SUM(C,BCD)); ZGSTAR:=(㈠ +㈡)/2; ZGEND:=CONST((㈠ +㈡)/2); STARDAY:=IF(DDCS2 {㈢:DRAWLINE(CURRBARSCOUNT=STARDAY,ZGSTAR,ISLASTBAR,ZGEND,1), COLORFF6E9D,LINETHICK2;} M:=INTPART(3*N1/5); AAA:=REF(H,M)=HHV(H,2*M+1); QYY:=BACKSET(AAA,M+1); CCC:=FILTER(QYY,M) AND H=HHV(H,M+1); DDDD:=BARSLAST(CCC),NODRAW; GDTSS:=IF(CCC,CURRBARSCOUNT,0); DINGBUTSS:=IF(DDDD,REF(GDTSS,DDDD),GDTSS); GDCS11:=CONST(DINGBUTSS); DINGBUTS11:=REF(DINGBUTSS,DDDD+1); GDCS22:=CONST(DINGBUTS11); Ⅰ:DRAWLINE(CURRBARSCOUNT=GDCS22,H,CURRBARSCOUNT=GDCS11,H,1), COLORFF85BE,LINETHICK1; AA11:=REF(L,M)=LLV(L,2*M+1); QY11:=BACKSET(AA11,M+1); CC11:=FILTER(QY11,M) AND L=LLV(L,M+1); DD11:=BARSLAST(CC11); DDTSS:=IF(CC11,CURRBARSCOUNT,0); DDTS11:=IF(DD11,REF(DDTSS,DD11),DDTSS); DDCS11:=CONST(DDTS11);