股票趋势线指标代码

| 淑娟

趋势线通过联结某一特定时期内证券或商品期货上升或下跌的最高或最低价格点而成。今天小编整理了股票趋势线指标代码(最新)供大家参考,一起来看看吧!

股票趋势线指标代码

股票趋势线指标代码

(通达信)

这个指标的思路理念是基于多种技术指标来判断股票的趋势、支撑、阻力、超买超卖等情况,并给出相应的操作建议。具体来说,这个代码包含以下几个部分:

上、中、下三条指数移动平均线(EMA),用来显示股票的短期、中期和长期趋势2。

超买和超卖两条点状线(POINTDOT),用来显示股票的过度波动区间2。

获利盘百分比(WINNER),用来计算持有该股票的投资者有多少比例是盈利的2。

趋势线(EMA),用来显示股票的整体走势2。

支撑和阻力两条点状线(POINTDOT),用来显示股票的上下界限2。

5日和13日两条简单移动平均线(MA),用来显示股票的近期变化3。

MA1和MA2两个变量,用来计算5日简单移动平均线的斜率和角度1。

N:=5;

M:=13;

上:EMA(CLOSE,3),COLORRED,LINETHICK1;

中:EMA(CLOSE,5),COLOR00FF00,LINETHICK1;

下:EMA(中,5),COLORWHITE,LINETHICK1;

超买:MA(CLOSE,10)×IF(CAPITAL=0,1.04,1.1),POINTDOT,COLORGREEN,LINETHICK2;

超卖:MA(CLOSE,10)×IF(CAPITAL=0,0.95,0.9),POINTDOT,COLORRED,LINETHICK2;

获利盘%:WINNER(C)×100,NODRAW,COLORWHITE;

{此句为计算获利盘比例,不需要可以不要}

趋势线:EMA(((SLOPE(C,21) × 20) + C),42),POINTDOT,COLORFF00FF,LINETHICK4;

V1:=ABS((2×C+H+L)/4-MA(C,20))/MA(C,20);

V2:=(1-7/100)×(DMA(C,V1));

V3:=(1+7/100)×(DMA(C,V1));

V5:=MA((L+H+C)/3,5);

支撑:=REFDATE(V2,DATE),POINTDOT,LINETHICK3,COLORCC66FF;

阻力:=REFDATE(V3,DATE),POINTDOT,LINETHICK3,COLORGREEN;

MA1:=MEMA(C,5);

MA2:=ATAN((MA1/REF(MA1,1)-1)×100)×180/3.1416;

MA3:=IF(MA2>0,MA2,MA2);

MA5:=MA(C,N),COLOR888899;

MA13:=MA(C,M),COLORFF00F0,LINETHICK2;

cxh1:=C=HHV(CLOSE,4) AND (REF(CLOSE,1)>=REF(CLOSE,2) OR REF(CLOSE,1)>=REF(CLOSE,3))

OR REF(CLOSE,1)=HHV(CLOSE,4) AND C>=REF(CLOSE,2) OR REF(CLOSE,2)=HHV(CLOSE,4) AND

REF(CLOSE,3)=LLV(CLOSE,4) AND C>=REF(CLOSE,1) OR REF(CLOSE,3)=HHV(CLOSE,4) AND

C>=REF(CLOSE,1) AND C>=REF(CLOSE,2);

cxh2:=C=HHV(CLOSE,4) AND REF(CLOSE,1)=LLV(CLOSE,4);

cxh3:=C=LLV(CLOSE,4) AND (REF(CLOSE,1)

REF(CLOSE,1)=LLV(CLOSE,4) AND C

REF(CLOSE,1)=HHV(CLOSE,4) AND C

C

cxh4:=REF(CLOSE,1)=LLV(CLOSE,4) AND C>=REF(CLOSE,2) OR REF(CLOSE,2)=LLV(CLOSE,4) AND

REF(CLOSE,1)<=REF(CLOSE,3) AND REF(CLOSE,2)=REF(CLOSE,1);

cxh5:=REF(CLOSE,1)=HHV(CLOSE,4) AND C

REF(CLOSE,1)>REF(CLOSE,3) OR REF(CLOSE,3)=HHV(CLOSE,4) AND REF(CLOSE,1)>REF(CLOSE,2)) AND

REF(CLOSE,2)>=REF(CLOSE,4) AND C

cxh6:=V5>REF(V5,1) AND REF(V5,1)

cxh7:=LHHV(V5,13) AND C>REF(CLOSE,1) AND C>O;

cxh8:=cxh7 AND COUNT(cxh6,2);

cxh9:=100×EMA(EMA(CLOSE-REF(CLOSE,1),6),6)/EMA(EMA(ABS(CLOSE-REF(CLOSE,1)),6),6);

cxh10:=EMA(MA(CLOSE,13),13);

cxh11:=FILTER((LLV(cxh9,2)=LLV(cxh9,7) AND COUNT(cxh9<0,2) AND

CROSS(cxh9,MA(cxh9,2)))=1,5);

cxh12:=FILTER((HHV(cxh9,2)=HHV(cxh9,7) AND COUNT(cxh9>50,2) AND

CROSS(MA(cxh9,2),cxh9))=1,1);

cxh13:=SMA(EMA((CLOSE-REF(CLOSE,1))/REF(CLOSE,1),5)×100,3,1)×10;

cxh14:=FILTER(((CROSS(cxh13,0) OR CROSS(CLOSE,cxh10)) AND cxh11)=1,3);

cxh15:=MA(CLOSE,18)>=REF(MA(CLOSE,18),3) AND CROSS(CLOSE,MA(CLOSE,18));

cxh16:=cxh8 AND NOT(REF(cxh8,1));

强攻:=IF(MA3>REF(MA3,1) AND MA3>=0,MA13,DRAWNULL),COLORYELLOW,LINETHICK2;

回调:=IF(MA30,MA13,DRAWNULL),COLORGREEN,LINETHICK2;

{KDJ}

RSV:=(C-LLV(L,9))/(HHV(H,9)-LLV(L,9))×100;

K:=SMA(RSV,3,1);

D:=SMA(K,3,1);

J:=3×K-2×D;

金叉:=CROSS(J,D);

死叉:=CROSS(D,J);

买1:=(cxh14 OR cxh15) AND cxh11;

买2:=(cxh14 OR cxh15) AND cxh4;

买3:=(cxh14 OR cxh15) AND cxh2;

买4:=(cxh2 AND cxh11) OR (cxh4 AND cxh11);

买5:=(金叉 AND cxh4) OR (金叉 AND cxh2) OR (金叉 AND cxh11);

{涨停}

STICKLINE(C>REF(C,1)×1.0985 AND C=H,C,O,4,-1),

COLOR00FFFF;

{跌停}

STICKLINE(C

COLORGREEN;

{蓝}

STICKLINE(O>=C,C,O,3.3,0),COLORFF7700;

STICKLINE(O>=C,C,O,2.4,0),COLORFF9900;

STICKLINE(O>=C,C,O,1.3,0),COLORFFBB00;

STICKLINE(O>=C,C,O,0.8,0),COLORCYAN;

{红}

STICKLINE(C>O,C,O,3.3,0),COLOR000099;

STICKLINE(C>O,C,O,2.4,0),COLOR0000CC;

STICKLINE(C>O,C,O,1.3,0),COLOR0000FF;

STICKLINE(C>O,C,O,0.8,0),COLORCC66FF;

{绿}

STICKLINE(cxh3,O,(O+C)/2,3.3,0),COLOR009900;

STICKLINE(cxh3,O,(O+C)/2,2.4,0),COLOR00BB00;

STICKLINE(cxh3,O,(O+C)/2,1.3,0),COLOR00DD00;

STICKLINE(cxh3,O,(O+C)/2,0.8,0),COLOR00FF00;

{灰}

STICKLINE(cxh4,O,(O+C)/2,3.3,0),COLOR999999;

STICKLINE(cxh4,O,(O+C)/2,2.2,0),COLORBBBBBB;

STICKLINE(cxh4,O,(O+C)/2,1.3,0),COLORDDDDDD;

STICKLINE(cxh4,O,(O+C)/2,0.8,0),COLORFFFFFF;

STICKLINE(金叉,O,C,1,0),COLORYELLOW;

STICKLINE(死叉,O,C,1,0),COLOR000099;

DRAWICON(cxh16,L-0.02,7);

DRAWICON(买1 OR 买2 OR 买3 OR 买4 OR 买5,L-0.01,1);

DRAWICON(死叉 OR cxh12 OR CROSS(40,cxh9),H+0.01,2);

X1:=(CLOSE+LOW+H)/3;

BB13:=ATAN(EMA(X1,13)-REF(EMA(X1,13),1))×3.1416×10;

EMA8:=EMA(CLOSE,8);

DRAWTEXT(FILTER(BB13>1 AND EMA(X1,13)>REF(EMA(X1,8),1),10),

EMA8,'∠45升'),COLORWHITE;

cxh81:=1;

cxh82:=((((2×C)+H)+L) / 4);

低金叉进:=20,COLORYELLOW,LINETHICK2;

高死叉出:=90,COLORGREEN,LINETHICK3;

cxh84:=LLV(L,5);

cxh85:=HHV(H,4);

C1:=(EMA((((cxh82-cxh84)/(cxh85-cxh84))×100),4)×cxh81),COLORFF00FF,LINETHICK2;

C2:=(EMA(((0.667×REF(C1,1))+(0.333×C1)),2)×cxh81),COLORFFFFFF,LINETHICK2;

条件:=CROSS(C1,C2) AND C1<40;

条件0:=CROSS(C2,C1) AND C1>90;

TJ1:=CROSS(C1,C2);

TJ2:=CROSS(C2,C1);

TJ3:=CROSS(C1,C2) AND REF(C1,1)<20;

TJ4:=CROSS(C2,C1) AND REF(C1,1)>80;

DRAWTEXT(条件0,H×1.02,'S'),COLORBLUE;

{DRAWTEXT(CROSS(C1,75),H×1.013,'险区'),COLORGREEN;}

DRAWTEXT(TJ3,L×0.98,'买底'),COLORFF00FF;

DRAWTEXT(TJ4,H×1.02,'逃顶'),COLORGREEN;

E1:=BARSCOUNT(C);

AH:=HHV(HIGH,200);

AL:=LLV(LOW,200);

B0:=(AH-AL)/40;

KB1:=H+B0;

KB2:=L-B0;

STICKLINE((E1+0)/34=FLOOR((E1+0)/34),KB2,KB2-0.8×B0,1,0),COLORYELLOW,LINETHICK3;

DRAWTEXT((E1+0)/34=FLOOR((E1+0)/34),KB2-B0,'时窗'),COLORYELLOW;

水平面:=EMA(C,89),COLOR3399FF;

AAA:=(3×C+HIGH+LOW+O)/6;

短趋:=(8×AAA+7×REF(AAA,1)+6×REF(AAA,2)+5×REF(AAA,3)+4×REF(AAA,4)+3×REF(AAA,5)+2×REF(AAA,6)+REF(AAA,8))/36;

中趋:=(LLV(短趋,2)+LLV(短趋,4)+LLV(短趋,6))/3;

{STICKLINE(C>中趋,短趋,中趋,0,0),COLORYELLOW;}

TTJ1:=V=HHV(V,10) AND V>2×REF(V,1) AND C>短趋;

立桩量:=FILTER(TTJ1,5);

TTJ2:=IF(BARSLAST(立桩量)=1 AND C>REF(H,1),1,IF(BARSLAST(立桩量)=2 AND C>REF(H,2),1,IF(BARSLAST(立桩量)=3 AND C>REF(H,3),1,0)));

突破:=TTJ2=1;

TTJ3:=IF(BARSLAST(立桩量)=1 AND C>REF(L,1),1,IF(BARSLAST(立桩量)=2 AND C>REF(L,2),1,IF(BARSLAST(立桩量)=3 AND C>REF(L,3),1,0)));

三天法则:=TTJ3=1;

成立:=三天法则 AND 突破;

条件成立:=FILTER(成立,3);

DRAWICON(条件成立,L×0.91,1);

DRAWTEXT(条件成立,L×0.91,'立桩'),COLORFF26FF;

MA(CLOSE,9),LINETHICK0,COLORYELLOW;

MA(CLOSE,21),LINETHICK0,COLORRED;

IF(MA(CLOSE,9)

IF(MA(CLOSE,21)

cxh90:=((((HHV((((EMA(DC,12)-EMA(DC,26))-(EMA((EMA(DC,12)-EMA(DC,26)),9)))×2),4)<0) AND ((((EMA(DC,12)-EMA(DC,26))-(EMA((EMA(DC,12)-EMA(DC,26)),9)))×2)>REF((((EMA(DC,12)-EMA(DC,26))-(EMA((EMA(DC,12)-EMA(DC,26)),9)))×2),1))) AND (REF((((EMA(DC,12)-EMA(DC,26))-(EMA((EMA(DC,12)-EMA(DC,26)),9)))×2),1)

DRAWTEXT(cxh90,L×0.98,'短买'),COLORRED;

通达信绝品趋势线副图指标源码

VAR1:=1;

趋势线: ((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)-50)×1.032+50),COLORRED;

VAR2:=(2×CLOSE+HIGH+LOW+OPEN)/5;

VAR3:=LLV(LOW,34);

VAR4:=HHV(HIGH,34);

SK: EMA((VAR2-VAR3)/(VAR4-VAR3)×100,13)×VAR1,COLORWHITE;

SD: EMA(SK,2)×VAR1,COLORYELLOW;

VAR5:=EMA(CLOSE,12)-EMA(CLOSE,26);

VAR6:=EMA(VAR5,9);

VAR7:=VAR1×CLOSE×1.236

VAR8:=CLOSE/REF(CLOSE,1)>1.021;

VAR9:=(HIGH-CLOSE)×1.36<=CLOSE-OPEN;

VARA:=(MA(CLOSE,120)-CLOSE)/CLOSE×100;

VARB:=ABS(VAR5-VAR6);

VARC:=STD(CLOSE,90)×10;

VARD:=COUNT((REF(CLOSE,15)-CLOSE)/CLOSE×100>45,5);

{买: VAR1×VAR7 AND VAR8 AND VAR9 AND VARC<25 AND CLOSE<8 AND VARA<114 AND VARB<=0.23×40,COLORRED;}

VARE:=SLOPE(CLOSE,40);

VARF:=COUNT((CLOSE-REF(CLOSE,1))/REF(CLOSE,1)<-0.098,90);

VAR10:=(MA(CLOSE,120)-CLOSE)/CLOSE×100;

VAR11:=VAR1×STD(CLOSE,63)×10;

VAR12:=VAR1×(MA(CLOSE,76)-MA(CLOSE,13)/3);

VAR13:=VAR1×MA((CLOSE-VAR12)/VAR12,1);

VAR14:=MA(CLOSE,5);

VAR15:=MA(CLOSE,10);

VAR16:=MA(CLOSE,20);

VAR17:=MA(CLOSE,30);

VAR18:=MA(CLOSE,60);

VAR19:=MA(CLOSE,150);

VAR1A:=MA(CLOSE,250);

VAR1B:=VAR1×VOL/CAPITAL×100;

VAR1C:=(CLOSE-VAR1A)/VAR1A×100;

VAR1D:=(CLOSE/REF(CLOSE,1)-1)×100;

VAR1E:=PWINNER(1,CLOSE);

VAR1F:=IF(VAR1>0.75 AND VAR1<0.901,0.618,1);

牛: IF(VAR14>VAR15 AND VAR15>VAR16 AND VAR16>VAR17 AND VAR16>VAR18 AND VAR19>VAR1A AND (VAR1E>=0.9 OR VAR1E>0.76 AND VAR1E<0.901 AND VAR1D>5 AND VAR1B>5) AND VAR1D>1.8 AND VAR1C<40 AND CLOSE>3 AND (CLOSE-VAR18)/VAR18<0.25 AND VAR1B<=6 AND VAR4×VAR1B>=1 AND CLOSE<18.5,76,0), COLORMAGENTA;

VAR20:=(MA(CLOSE,3)+MA(CLOSE,6)+MA(CLOSE,12)+MA(CLOSE,24))/4;

VAR21:=(MA(CLOSE,48)+MA(CLOSE,6)+MA(CLOSE,12)+MA(CLOSE,24))/4;

VAR22:=VAR1×(MA(CLOSE,12)+MA(CLOSE,24)+MA(CLOSE,48)+MA(CLOSE,96))/4;

VAR23:=VAR1×MA(CLOSE,250);

VAR24:=MA(CLOSE,125);

牛1:=IF(SD>18 AND SK<75 AND CROSS(VAR20,VAR21) AND (VAR22-VAR23)/VAR23<0.161 AND REF(SK,3)

VAR25:=CLOSE/MA(CLOSE,3)>=1.05 AND CLOSE=HHV(CLOSE,3) AND MA(VOL,2)/MA(VOL,40)>=3 AND MA(VOL,2)=HHV(MA(VOL,2),3) AND VOL>REF(VOL,1) AND CLOSE>REF(CLOSE,1);

VAR26:=REF(CLOSE,1);

VAR27:=SMA(MAX(CLOSE-VAR26,0),5,1)/SMA(ABS(CLOSE-VAR26),5,1)×100;

VAR28:=VAR1×COUNT(VAR27<25,20)>=1;

VAR29:=(HIGH-LOW)/HIGH×100+(CLOSE-VAR26)/VAR26×100;

VAR2A:=EMA(MA(VAR29,41),6);

VAR2B:=VAR2A>LLV(VAR2A,6)×1.02 AND REF(VAR2A,1)

VAR2C:=VAR1×LLV(LOW,6)=LLV(LOW,41) AND LLV(LOW,6)

VAR2D:=HIGH>LOW×1.033;

{涨势确立: VAR1×(VAR2C>0 AND VAR2D×16+81.5)×VAR1,COLOR80FFFF ;}

买入: IF(CROSS(趋势线,21),50,18.5);

{卖出: IF(CROSS(87,趋势线),50,81.5),COLORFFAA00;}

DRAWTEXT(VAR2C>0 AND VAR2D,88,'↑');

VAR2E:=IF(CROSS(SK,SD),25,18.5);

VAR2F:=IF(CROSS(SD,SK),75,81.5);

VAR13<0.06×(-10)+81.5,COLORWHITE;

VAR30:0-SQRT(SQRT(FLOOR(SQRT(MA(1/WINNER(CLOSE)×100,4)/10000))))×5;

STICKLINE(VAR30<-2,0,VAR30,1.5,1), COLORYELLOW;

趋势线怎么样进行分析股票

由于证券价格的变化是有一定的趋势的,也就是说是有方向的,并且这种趋势或方向可以用直线表示出来,这样的直线就是趋势线。

趋势线反映股票价格向上波动发展的直线就是上升趋势线,趋势线反映股票价格向下波动发展的直线就是下降趋势线。由于股票趋势线价格的波动可以分为长期趋势、中期趋势和短期趋势三种,因此表示价格的趋势线也就有长期趋势线、中期趋势线和短期趋势线三种。

一般来说,趋势线有以下两种作用:

(1)趋势线可以对今后价格的变化起约束作用,使价格的变化总保持在这条趋势线上。

(2)如果在趋势线股价的运行中趋势线被突破,就说明股票价格有强烈的反转信号。越重要的趋势线被突破,股价反转的信号也就越强烈。趋势线在被突破后将起相反的作用。

29923