以下是通达信1个趋势主图+2个趋势副图源码
{趋势主图源码}
M1:=55;
HR:=HHV(HIGH,M1);
HRY:=LLV(LOW,M1);
HRY11:=HR*HRY;
HRY33:SQRT(HRY11),COLORGREEN,LINETHICK2;
IF(C>HRY33 AND HRY33 >=REF(HRY33 ,1), HRY33 ,DRAWNULL),LINETHICK2,COLORRED;
WLT1:=MA(C,5);
WLT2:=MA(C,10);
DRAWBAND(WLT1,RGB(255,255,0),WLT2,RGB(0,0,220));
{横盘整理}
HP:=(HHV(CLOSE,10)-LLV(CLOSE,10))/CLOSE<0.10;
{量比}
LB:=VOL/MA(VOL,5);
{上升角度}
X1:=(C+L+H)/3;
BB5:=ATAN(EMA(X1,7)-REF(EMA(X1,7),1))*3.1416*10;
DRAWTEXT(FILTER(BB5>1 AND EMA(X1,7)>REF(EMA(X1,7),1),10),
LOW*0.99,'★∠45'),COLORFFFFFF;
TT:=FILTER(BB5>1 AND EMA(X1,7)>REF(EMA(X1,7),1),10);
MM:=WLT1>REF(WLT1,1) AND REF(WLT1,1);
GG1:=CROSS(WLT1,WLT2);{均线向上金叉}
{CCI指标}
TYP:= (HIGH + LOW + CLOSE)/3;
CCI1:=(TYP-MA(TYP,6))/(0.015*AVEDEV(TYP,5));
差值1:=ABS(REF(CCI1,1)-CCI1),LINETHICK0;
CCI2:=(TYP-MA(TYP,10))/(0.015*AVEDEV(TYP,10));
差值2:=ABS(REF(CCI2,1)-CCI2),LINETHICK0;
CCI3:=(TYP-MA(TYP,20))/(0.015*AVEDEV(TYP,20));
差值3:=ABS(REF(CCI3,1)-CCI3),LINETHICK0;
CCI4:=(TYP-MA(TYP,30))/(0.015*AVEDEV(TYP,30));
差值4:=ABS(REF(CCI4,1)-CCI4),LINETHICK0;
CCI5:=(TYP-MA(TYP,60))/(0.015*AVEDEV(TYP,60));
差值5:=ABS(REF(CCI5,1)-CCI5),LINETHICK0;
CCI:=(CCI1+CCI2+CCI3+CCI4+CCI5)/2,COLORRED,LINETHICK2;
WLT91:=HHV(CCI,13);{CCI的13日内最高}
WLT92:=LLV(CCI,13)<-100;{CCI的13日内最低值小于-100}
WLT95:=COUNT(WLT92,13)>=3;{CCI的13日内最低值小于-100的情况不少于3次}
WLT93:=CCI>WLT91;{CCI大于前13日内最高}
WLT96:=CROSS(CCI,100);{CCI上穿100}
TJ91:=WLT95 AND WLT96;
JLP:=FILTER(TJ91,5);{CCI的13日内完成探底后走强}
超买:=MA(C,10)*IF(CAPITAL=0,1.04,1.1),POINTDOT,COLORGREEN,LINETHICK2;
超卖:=MA(C,10)*IF(CAPITAL=0,0.95,0.9),POINTDOT,COLORRED,LINETHICK2;
TEND:EMA(((SLOPE(CLOSE,21) * 20) + CLOSE),42)
,POINTDOT,COLORFF00FF,LINETHICK4;
DD:=TEND>REF(TEND,1) AND REF(TEND,1) >REF(TEND,2);{趋势线向上转折}
GG2:=CROSS(WLT1,TEND);{均线与趋势线向上金叉}
HRY1:=LLV(LOW,55);
HRY2:=HHV(HIGH,21);
GG3:=C<HRY2*0.8 AND C>HRY33;{股价高于牛熊线,低于21日内最高价的80%}
JJ1:=C<HRY1*1.62;
TJ1:=GG1;{均线向上金叉}
TJ2:=GG2 AND JJ1;
TJ3:=GG1 AND GG3;
XG:=TJ1 OR TJ3 ;
XG2:=C<HRY2*0.86 OR LB>1;
XG1:=XG AND XG2 AND C>HRY33 AND JLP;
XG3:=XG AND C<HHV(HIGH,250)*0.3;
XG11:=XG1 OR XG3;
DRAWICON(XG11,LOW*0.97,23);
DRAWTEXT(XG1,LOW*0.95,'全'),COLORFFFFFF;
DRAWTEXT(XG1,LOW*0.93,'仓'),COLORFFFFFF;
{红绿柱趋势副图源码}
VAR1:=(HHV(HIGH,9)-CLOSE)/(HHV(HIGH,9)-LLV(LOW,9))*100-70;
VAR2:=SMA(VAR1,9,1)+100;
VAR3:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
VAR4:=SMA(VAR3,3,1);
VAR5:=SMA(VAR4,3,1)+100;
VAR6:=VAR5-VAR2;
趋势: IF(VAR6>45,VAR6-45,0);
STICKLINE(REF(趋势,1)< 趋势, 趋势,REF(趋势,1),2,0),COLORMAGENTA;
STICKLINE(REF(趋势,1)> 趋势, 趋势,REF(趋势,1),2,0),COLORGREEN;
DRAWICON(FILTER(REF(趋势,1)< 趋势 AND REF(趋势,1)<1,5),趋势,23);
{红兰带趋势副图源码}
分水岭: DMA(EMA(CLOSE,12),SUM(VOL,5)/3/CAPITAL),COLOR00FFFF,LINETHICK2;
CCC:C,COLORFFFFFF;
UPPER : MA(CLOSE,14)*1.06,POINTDOT,COLORFF99FF,LINETHICK2;
LOWER : MA(CLOSE,14)*0.94,POINTDOT,COLORFF00FF,LINETHICK2;
MID:(UPPER+LOWER)/2,NODRAW,COLOR00FFFF,LINETHICK1;
VAR1:=(2*CLOSE+HIGH+LOW+OPEN)/5;
A1: (EMA(VAR1,1)+EMA(VAR1,2)+EMA(VAR1,3)+EMA(VAR1,4))/4,COLORCYAN,LINETHICK1;
W1:=(EMA(VAR1,1)+EMA(VAR1,2)+EMA(VAR1,3)+EMA(VAR1,4))/4;
A2: EMA(A1,2),COLORCYAN,LINETHICK1;
W2:=EMA(A1,2);
A3: EMA(A2,2),COLORCYAN,LINETHICK1;
W3:=EMA(A2,2);
A4: EMA(A3,2),COLORCYAN,LINETHICK1;
W4:=EMA(A3,2);
A5: EMA(A4,2),COLORCYAN,LINETHICK1;
W5:=EMA(A4,2);
A6: EMA(A5,2),COLORCYAN,LINETHICK1;
W6:= EMA(A5,2);
A7: EMA(A6,2),COLORCYAN,LINETHICK1;
W7:= EMA(A6,2);
IF(W1>REF(W1,1),A1,DRAWNULL),COLORRED,LINETHICK1;
IF(W2>REF(W2,1),A2,DRAWNULL),COLORRED,LINETHICK1;
IF(W2>REF(W3,1),A3,DRAWNULL),COLORRED,LINETHICK1;
IF(W2>REF(W4,1),A4,DRAWNULL),COLORRED,LINETHICK1;
IF(W2>REF(W5,1),A5,DRAWNULL),COLORRED,LINETHICK1;
IF(W2>REF(W6,1),A6,DRAWNULL),COLORRED,LINETHICK1;
IF(W2>REF(W7,1),A7,DRAWNULL),COLORRED,LINETHICK1;
DRAWICON(CROSS(CCC,LOWER ) AND CROSS(CCC,A3 ),LOWER,23);
DRAWICON(CROSS(UPPER,CCC),UPPER,15);
DRAWTEXT(CROSS(CCC,UPPER),UPPER,'A'),COLORYELLOW;