通达信趋势副图指标源码分享

DRAWGBK(C>0,RGB(0,0,110),RGB(0,25,0),0,' ',0);

{趋势}

CVAR1:=MA(LOW,1);

CVAR2:=MA(HIGH,2);

CVAR3:=MA(CLOSE,2);

CVAR4:=(CVAR3-LLV(CVAR1,9))/(HHV(CVAR2,9)-LLV(CVAR1,9))*100;

CVAR5:=SMA(CVAR4,3,1);

CX1:=SMA(CVAR5,3,1),COLORRED,LINETHICK2;

CXY1:=SMA(CX1,3,1);

CVAR6:=(HHV(CVAR2,9)-CVAR3)/(HHV(CVAR2,9)-LLV(CVAR1,9))*100;

CX2:=SMA(CVAR6,3,1),COLORYELLOW,LINETHICK2;

CXY2:=SMA(CX2,3,1);

CVAR7:=REF(CVAR3,1);

CVAR8:=SMA(MAX(CVAR3-CVAR7,0),13,1)/SMA(ABS(CVAR3-CVAR7),13,1)*100;

VARB:=MA(INDEXC,3)*100/MA(INDEXC,10)-100;

VARC:=MA(CLOSE,3)*100/MA(CLOSE,10)-100;

VARD:=CLOSE*100/MA(CLOSE,10)-100;

CVARE:=IF(VARB>10,10,VARB);

CVARF:=IF(CVARE<-10,-10,CVARE);

CVAR10:=IF(VARC>10,10,VARC);

CVAR11:=IF(CVAR10<-10,-10,CVAR10);

CVAR12:=REF(VARB,1);

CVAR13:=100*(CVAR3-REF(CVAR3,1))/REF(CVAR3,1);

VAR14:=INDEXC;

VAR15:=REF(VAR14,1);

VAR16:=100*(VAR14-VAR15)/VAR14;

VAR17:=MA(CVAR13,3);

VAR18:=MA(VAR16,3);

VAR19:=(3*CLOSE+CVAR1+OPEN+HIGH)/6;

CVAR1A:=(20*VAR19+19*REF(VAR19,1)+18*REF(VAR19,2)+17*REF(VAR19,3)+16*REF(VAR19,4)+15*REF(VAR19,5)+14*REF(VAR19,6)+13*REF(VAR19,7)+12*REF(VAR19,8)+11*REF(VAR19,9)+10*REF(VAR19,10)+9*REF(VAR19,11)+8*REF(VAR19,12)+7*REF(VAR19,13)+6*REF(VAR19,14)+5*REF(VAR19,15)+4*REF(VAR19,16)+3*REF(VAR19,17)+2*REF(VAR19,18)+REF(VAR19,20))/210;

CVAR1B:=MA(CVAR1A,12);

CVAR1C:=EMA(CVAR1A,5);

VAR1D:=ABS(CVAR1A-CVAR1B);

VAR1E:=REF(CVAR3,1)*0.015;

VAR1F:=REF(INDEXC,1);

VAR24:=ZIG(3,10)>REF(ZIG(3,10),1) AND REF(ZIG(3,10),1)<REF(ZIG(3,10),2);

VAR25:=ZIG(3,10)<REF(ZIG(3,10),1) AND REF(ZIG(3,10),1)>REF(ZIG(3,10),2);

VAR26:=MA(CLOSE,26);

VAR27:=VAR26+2*STD(CVAR3,26);

VAR28:=VAR26-2*STD(CVAR3,26);

VAR29:=VAR26+2*STD(REF(CVAR3,1),26);

VAR2A:=VAR26-2*STD(REF(CVAR3,1),26);

VAR2B:=IF(VAR24 AND CVAR1<VAR28,1,0);

VAR2C:=IF(VAR25*CVAR1 AND CVAR2>VAR27,2,VAR2B);

VAR2D:=IF(VAR2C=1,80,45);

VAR2E:=IF(VAR2C=2,0,VAR2D);

VAR2F:=VAR2E;

CXD1:=EMA(3*SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*100,5,1)-2*SMA(SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*100,5,1),3,1),5);

CXD2:=REF(CXD1,1);

STICKLINE(CXD1>=REF(CXD1,1),CXD1,CXD2,2,0),COLOR0055AA;

STICKLINE(CXD1<REF(CXD1,1),CXD1,CXD2,2,0),COLOR006600;

STICKLINE(CXD1>=REF(CXD1,1),CXD1,CXD2,1,0),COLOR0099DD;

STICKLINE(CXD1<REF(CXD1,1),CXD1,CXD2,1,0),COLOR00BB00;

{KD漂带}

LOWV:=LLV(LOW,9);

HIGHV:=HHV(HIGH,9);

CXRSV:=EMA((CLOSE-LOWV)/(HIGHV-LOWV)*100,3);

CXKK:EMA(CXRSV,3),COLORWHITE,LINETHICK1;

CXDD:MA(CXKK,3),COLORLIRED,LINETHICK1;

DRAWBAND(CXKK,RGB(160,32,240),CXDD,RGB(0,0,255));

持仓线:=EMA(100*(CLOSE-LLV(LOW,34))/(HHV(HIGH,34)-LLV(LOW,34)),3),COLORYELLOW,LINETHICK1;

DRAWICON(FILTERX(持仓线>88.6,5),88.6,2);

预警线1: 88.6,COLOR8000FF,DOTLINE;

预警线2: 78.6,COLOR76EC00,DOTLINE;

10,COLORRED,DOTLINE;

0,COLORYELLOW,DOTLINE;