通达信指标公式源码画线
新版极品整合MACD划线指标公式通达信指标公式源码
通达信新版极品整合MACD划线指标公式DIF:EMA(CLOSE,12)-EMA(CLOSE,26);DEA:EMA(DIF,9),COLOR888888;NOTEXT5:IF(DIF>=DEA, DIF,DRAWNULL),COLORRED;NOTEXT6:IF(DIF<DEA, DIF,DRAWNULL),COLORWHITE;AT1:=BARSLAST(REF(CROSS(DIF,DEA),1));BT1:=REF(C,AT1+1)>C AND REF(DIF,AT1+1)<DIF AND CROSS(DIF,DEA); AT2:=BARSLAST(REF(CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3)),1));CT1:=BARSLAST(REF(CROSS(DEA,DIF),1));DT1:=REF(C,CT1+1)<C AND REF(DIF,CT1+1)>DIF AND CROSS(DEA,DIF); MACD底背:IF(BT1>0,-0.1,0),COLORRED;MACD顶背:IF(DT1>0,0.1,0),COLOR00FF00;STICKLINE(BT1>0,0.5*DIF,0,2,0),COLORRED;STICKLINE(DT1>0,0.5*DIF,0,2,0),COLOR00FF00;MACD:(DIF-DEA)*2,COLORSTICK;STICKLINE(MACD<REF(MACD,1) AND MACD>0, 0,MACD,0,0),COLOR44FF00; STICKLINE(MACD>REF(MACD,1) AND MACD<0, 0,MACD,0,0),COLOR0066FF;M1:=13;M2:=13;A1:=REF(DIF,M1)=HHV(DIF,2*M1+1);B1:=FILTER(A1,M1);C1:=BACKSET(B1,M1+1);D1:=FILTER(C1,M1);E1:=BACKSET(ISLASTBAR,BARSLAST(D1)+1);F1:=E1>REF(E1,1);A2:=REF(DIF,M2)=LLV(DIF,2*M2+1);B2:=FILTER(A2,M2);C2:=BACKSET(B2,M2+1);D2:=FILTER(C2,M2);E2:=BACKSET(ISLASTBAR,BARSLAST(D2)+1);F2:=E2>REF(E2,1);压力线:DRAWLINE(D1,DIF,F1,DIF,0),COLORFFFF00,DOTLINE;支撑线:DRAWLINE(D2,DIF,F2,DIF,0),COLOR00AAFF,DOTLINE;G3:=FILTERX(支撑线>REF(支撑线,1) && DIF>支撑线&& REF(支撑线,1)=REF(DIF,1),2); 底抬高:DRAWLINE(D2,DIF,G3,支撑线,0),COLORYELLOW,DOTLINE;{画趋势线}M:=INTPART(3*10/5);A12:=REF(DIF,M)=HHV(DIF,2*M+1);B12:=FILTER(A12,M);C12:=BACKSET(B12,M+1);D12:=FILTER(C12,M);R112:=BACKSET(ISLASTBAR,BARSLAST(D12)+1);S112:=R112>REF(R112,1);AL12:=REF(DIF,M)=LLV(DIF,2*M+1);BL12:=FILTER(AL12,M);CL12:=BACKSET(BL12,M+1);DL12:=FILTER(CL12,M);RL112:=BACKSET(ISLASTBAR,BARSLAST(DL12)+1);SL112:=RL112>REF(RL112,1);短压线:DRAWLINE(D12,DIF,S112,DIF,0),COLOR99FF00,DOTLINE;短撑线:DRAWLINE(DL12,DIF,SL112,DIF,0),COLOR0055FF,DOTLINE;VARX2:=LLV(DEA,43);VARX3:=DEA-(DIF-DEA);低点线:=IF(DIF<VARX2 AND DEA=VARX2,MIN(HHV(VARX2,10),VARX3),VARX2);VL:=REF(LOW,1);VAR12:=(SMA(ABS(LOW-VL),13,1))/(SMA(MAX(LOW-VL,0),13,1))*100;VAR14:=MA(VAR12,13);VAR15:=LLV(LOW,34);VAR18:=EMA(IF(LOW<=VAR15,VAR14,0),3);VAR110:=SMA(SMA((CLOSE-LLV(LOW,55))/(HHV(HIGH,55)-LLV(LOW,55))*100,7,1),5,1); VAR111:=SMA((CLOSE-LLV(LOW,55))/(HHV(HIGH,55)-LLV(LOW,55))*100,8,1)*15-VAR1 10*10.38;T:=FILTER(IF(VAR111<=VAR110 AND VAR18>0,VAR18*8,0),5);止跌:DRAWTEXT(T AND DIF<低点线,DIF*1.01,'止跌'),COLORYELLOW;{形态}A:=IF(CROSS(0,DEA),1,0);A11:=IF(DIF<0 AND CROSS(DIF,DEA),1,0);SS:=IF(A,SUM(A11,0),0);SSB:=HHV(SS,0);SSS:=SUM(A11,0);W底:=SSS-SSB=2 AND SSS>REF(SSS,1);DRAWTEXT(W底,DIF,'↖W底'),COLOR0080FF;MACD金叉:=CROSS(MACD,DIF) AND MACD>=(0-0.05) AND MACD<=0.02; DRAWTEXT(MACD金叉,MACD,'-MACD金叉'),COLOR00FFFF;低位金叉:=CROSS(DIF,DEA) AND DIF<-0.1;JCCOUNT:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>=0));二次金叉:=CROSS(DIF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1; DRAWTEXT(二次金叉,0.01,'二次金叉'),COLOR5500FF;AA11:=BARSLAST(REF(CROSS(DIF,DEA),1));底背离:=REF(CLOSE,AA11+1)>CLOSE AND DIF>REF(DIF,AA11+1) ANDCROSS(DIF,DEA);底背:DRAWLINE(AA11=0,DIF,底背离,DIF,0),COLORYELLOW,LINETHICK2;AA22:=BARSLAST(REF(CROSS(DEA,DIF),1));顶背离:=REF(CLOSE,AA22+1)<CLOSE AND REF(DIF,AA22+1)>DIF ANDCROSS(DEA,DIF);顶背:DRAWLINE(AA22=0,DIF,顶背离,DIF,0),COLORGREEN,LINETHICK2; DRAWTEXT(底背离,DIF*0.5,'-DIF底背'),COLOR0055FF;DRAWTEXT(顶背离,DIF*0.5,'-DIF顶背'),COLOR99FF00;{小周期}N:=3;DIF3_6.5F:=(EMA(CLOSE,3)-(EMA(CLOSE,6)+EMA(CLOSE,7))/2);DEA3_6.5F:=(EMA(DIF3_6.5F,3)+EMA(DIF3_6.5,2));AA:=REF(DIF3_6.5F,N)=HHV(DIF3_6.5F,2*N+1);CC:=FILTER(BB,N) AND DIF3_6.5F=HHV(DIF3_6.5F,N+1);AX1:=BARSLAST(REF(CC,1));小顶背离:=REF(CLOSE,AX1+1)<CLOSE AND REF(DIF3_6.5F,AX1+1)>DIF3_6.5F AND CC; DRAWTEXT(小顶背离,DIF3_6.5F*1.2,'-小顶背离'),COLORGREEN;DRAWICON(小顶背离>0,DIF3_6.5F*1.2,2);AAA2:=REF(DIF3_6.5F,N)=LLV(DIF3_6.5F,2*N+1);BBB2:=BACKSET(AAA2,N+1);CCC2:=FILTER(BBB2,N) AND DIF3_6.5F=LLV(DIF3_6.5F,N+1);AX2:=BARSLAST(REF(CCC2,1));小底背离:=REF(CLOSE,AX2+1)>CLOSE AND REF(DIF3_6.5F,AX2+1)<DIF3_6.5F;{画白柱线}VA1:=HHVBARS(MACD,BARSLAST(MACD<0)+1);VA2:=CROSS(BACKSET(CROSS(0,MACD),REF(VA1,1)+2),0.5);QG:=CROSS(BACKSET(CROSS(0,MACD) OR (ISLASTBAR ANDMACD>0),REF(VA1,1)+2),0.5);前高:=DRAWLINE(VA2,MACD,REF(VA2,1),REF(MACD,1),1),COLORMAGENTA;VA3:=LLVBARS(MACD,BARSLAST(MACD>0)+1);VA4:=CROSS(BACKSET(CROSS(MACD,0),REF(VA3,1)+2),0.5);前低:=DRAWLINE(VA4,MACD,REF(VA4,1),REF(MACD,1),1);BD:=BARSLAST(FILTERX(CROSS(0,MACD),BARSCOUNT(C)));BDTJ:=IF(MACD<0,FILTERX(MACD=LLV(MACD,BARSLAST(MACD>0)),BARSCOUNT(C)),DRAWNULL);TSBDTJ:=BARSLAST(BDTJ);BDZH:=FILTERX(MACD<CONST(LLV(MACD,BD+1)),BARSCOUNT(C));BDTS:=BARSLAST(BDZH);本低:=IF(BD+1>=1,CONST(LLV(MACD,BD+1)),DRAWNULL);BDCL:=CROSS(COUNT(CROSS(MACD>本低/2 AND MACD<0,0.5),TSBDTJ)=1,0.5) AND TSBDTJ>=0;终点:=IF(ISLASTBAR AND MACD>0 AND MACD=HHV(MACD,BARSLAST(MACD<0)),1,IF(FILTERX(QG,BARSCOUNT(C)),2,DRAWNULL));UU:=(终点=1 OR 终点=2) AND MACD>0;ZZ:=FILTERX(UU,BARSCOUNT(C));本高:=DRAWLINE(ZZ,MACD,REF(ZZ,1),REF(MACD,1),1),COLORWHITE;WQG:=CROSS(COUNT(CROSS(MACD<本高/2 AND MACD>0,0.5),ZZ)=1,0.5) AND ZZ>=0;STICKLINE(MACD>前高,MACD,前高,0,0),COLORFFFFFF;STICKLINE(MACD<0 AND MACD<前低AND 前低<0,MACD,前低,0,0),COLORFFFFFF; DRAWICON(CROSS(DIF,DEA),DEA,1);DRAWICON(CROSS(DEA,DIF),DEA,2);底:ABS((CROSS("MACD.DIF","MACD.DEA")&&"MACD.DEA"<=-0.07)*"MACD.DIF")*1.50, COLORLIMAGENTA;DRAWTEXT(ABS(底)>0,底*1.20,'底'),COLORYELLOW;。
通达信指标公式源码主力状态 价量线主线快线副图指标
{价量线主线快线}价量: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),COLOR00CCFF,NODRAW;主线:(((价量-LLV(价量,27))/(HHV(价量,27)-LLV(价量,27)))*(4))*(25),COLORCYAN,NODRAW;快线:(((价量-LLV(价量,9))/(HHV(价量,9)-LLV(价量,9)))*(4))*(25),COLOR55AAFF,NODRAW;RSV:=(CLOSE-LLV(LOW,13))/(HHV(HIGH,13)-LLV(LOW,13))*100;K1:=SMA(RSV,3,1);D1:=SMA(K1,3,1);KK:=INTPART(K1);DD:=INTPART(D1);TFXXS:=KK+DD;{变异KD风险系数}TGLXS:=(TFXXS-REF(TFXXS,1));{变异KD乖离系数:资金流向}{红}STICKLINE(TGLXS>0 AND TGLXS>REF(TGLXS,1),100,TGLXS+100,2.5,0),COLOR0000AA;STICKLINE(TGLXS>0 AND TGLXS>REF(TGLXS,1),100,TGLXS+100,1.5,0),COLOR0022CC; STICKLINE(TGLXS>0 AND TGLXS>REF(TGLXS,1),100,TGLXS+100,0.5,0),COLOR0055FF; {粉}STICKLINE(TGLXS<0 AND TGLXS>REF(TGLXS,1),100,TGLXS+100,2.5,0),COLORAA00BB; STICKLINE(TGLXS<0 AND TGLXS>REF(TGLXS,1),100,TGLXS+100,1.5,0),COLORCC22BB; STICKLINE(TGLXS<0 AND TGLXS>REF(TGLXS,1),100,TGLXS+100,0.5,0),COLORFF55BB; {黄}STICKLINE(TGLXS>0 AND TGLXS<=REF(TGLXS,1),100,TGLXS+100,2.5,0),COLOR00AAFF; STICKLINE(TGLXS>0 AND TGLXS<=REF(TGLXS,1),100,TGLXS+100,1.5,0),COLOR00CCFF; STICKLINE(TGLXS>0 AND TGLXS<=REF(TGLXS,1),100,TGLXS+100,0.5,0),COLOR00FFFF; {蓝}STICKLINE(TGLXS<0 AND TGLXS<=REF(TGLXS,1),100,TGLXS+100,2.5,0),COLORFF7700; STICKLINE(TGLXS<0 AND TGLXS<=REF(TGLXS,1),100,TGLXS+100,1.5,0),COLORFFAA22; STICKLINE(TGLXS<0 AND TGLXS<=REF(TGLXS,1),100,TGLXS+100,0.5,0),COLORFFFF55; STICKLINE(TGLXS=0 AND REF(TGLXS,1)>=0,100,TGLXS+100,8,0),COLORBROWN; STICKLINE(TGLXS=0 AND REF(TGLXS,1)<0,100,TGLXS+100,8,0),COLORWHITE; ZLCM:=EMA(WINNER(CLOSE)*70,3);{主力筹码估算}SHCM:=EMA((WINNER(CLOSE*1.1)-WINNER(CLOSE*0.9))*80,3);{散户筹码估算} ZSHTL:=SHCM/(ZLCM+SHCM)*100;{散户套牢筹码系数}ZZLKP:=ZLCM/(ZLCM+SHCM)*100;{主力控盘筹码系数}ZSHJJ:=EMA(ZSHTL,55);{散户警戒}ZZLJJ:=EMA(ZZLKP,55);{主力警戒}散兵坑:IF(ZZLKP<=10,ZZLKP,ZZLKP),COLORMAGENTA,NODRAW;{散户套牢筹码}{好}STICKLINE(C>0,ZSHTL,ZZLKP,2,0),COLOR808080;{散户筹码警戒}STICKLINE(ZSHJJ>REF(ZSHJJ,1),ZSHTL,ZSHJJ,2,0),COLORC0C0C0;{主力控盘筹码}{粉}STICKLINE(ZZLKP>REF(ZZLKP,1) AND ZZLKP>20,ZZLKP,20,2.5,0 ),COLORAA00BB; STICKLINE(ZZLKP>REF(ZZLKP,1) AND ZZLKP>20,ZZLKP,20,1.5,0 ),COLORCC22BB; STICKLINE(ZZLKP>REF(ZZLKP,1) AND ZZLKP>20,ZZLKP,20,0.5,0 ),COLOREE44BB; {蓝}STICKLINE(ZZLKP<=REF(ZZLKP,1) AND ZZLKP>20,ZZLKP,20,2.5,0 ),COLORFF7700; STICKLINE(ZZLKP<=REF(ZZLKP,1) AND ZZLKP>20,ZZLKP,20,1.5,0 ),COLORFFAA22; STICKLINE(ZZLKP<=REF(ZZLKP,1) AND ZZLKP>20,ZZLKP,20,0.5 ,0 ),COLORFFFF55;{亮红}STICKLINE(ZZLKP>REF(ZZLKP,1) AND ZZLKP<20,ZZLKP,0,2.5,0 ),COLOR131FFD; STICKLINE(ZZLKP>REF(ZZLKP,1) AND ZZLKP<20,ZZLKP,0,1.5,0 ),COLOR5050FF; STICKLINE(ZZLKP>REF(ZZLKP,1) AND ZZLKP<20,ZZLKP,0,0.5,0 ),COLOR7E7EFF;{深蓝}STICKLINE(ZZLKP<=REF(ZZLKP,1) AND ZZLKP<20,ZZLKP,0,2.5,0 ),COLORAA0000; STICKLINE(ZZLKP<=REF(ZZLKP,1) AND ZZLKP<20,ZZLKP,0,1.5,0 ),COLORCC0000; STICKLINE(ZZLKP<=REF(ZZLKP,1) AND ZZLKP<20,ZZLKP,0,0.5 ,0 ),COLORFF0000;{主力筹码警戒}{黄}STICKLINE(ZZLJJ>REF(ZZLJJ,1),ZZLKP,ZZLJJ,2.5,0 ),COLOR00AAFF; STICKLINE(ZZLJJ>REF(ZZLJJ,1),ZZLKP,ZZLJJ,1.5,0 ),COLOR00CCFF; STICKLINE(ZZLJJ>REF(ZZLJJ,1),ZZLKP,ZZLJJ,0.5,0 ),COLOR00FFFF;{红}STICKLINE(ZZLKP>ZZLJJ AND ZZLJJ>50,ZZLKP,ZZLJJ,2.5,0 ),COLOR0000AA; STICKLINE(ZZLKP>ZZLJJ AND ZZLJJ>50,ZZLKP,ZZLJJ,1.5,0 ),COLOR0022CC; STICKLINE(ZZLKP>ZZLJJ AND ZZLJJ>50,ZZLKP,ZZLJJ,0.5 ,0 ),COLOR0055FF; {红}STICKLINE(ZZLKP>ZZLJJ AND ZZLJJ<50 AND ZZLKP>50AND ZZLJJ>REF(ZZLJJ,1),ZZLKP,50,2.5,0 ),COLOR0000AA;STICKLINE(ZZLKP>ZZLJJ AND ZZLJJ<50 AND ZZLKP>50AND ZZLJJ>REF(ZZLJJ,1),ZZLKP,50,1.5,0 ),COLOR0022CC;STICKLINE(ZZLKP>ZZLJJ AND ZZLJJ<50 AND ZZLKP>50AND ZZLJJ>REF(ZZLJJ,1),ZZLKP,50,0.5 ,0 ),COLOR0055FF;{铸顶风险区}{绿}STICKLINE(ZZLKP>80,ZZLKP,ZZLKP-(ZZLKP-80)/2,2.5,0),COLOR00AA00; STICKLINE(ZZLKP>80,ZZLKP,ZZLKP-(ZZLKP-80)/2,1.5,0),COLOR00CC00; STICKLINE(ZZLKP>80,ZZLKP,ZZLKP-(ZZLKP-80)/2,0.5,0),COLOR00FF00; {散兵坑}STICKLINE(ZZLKP<=10,ZZLKP,0,5,0),COLORDD00DD;100,COLORGREEN;80,COLORGREEN;{0,COLORGREEN;}{主线快线}价量,COLOR0CC0FF,LINETHICK2;主线,COLOR00FFAA,LINETHICK2;快线,LINESTICK,COLORFF68DD;。
通达信指标公式源码 自动画通道+庄家成本+大胆做多主图指标 源码
N:=15;UR:=6;LR:=6;TC1:=IF(H=HHV(H,8*UR),H,DRAWNULL);TC2:=CONST(BARSLAST(TC1=H))+1;UPPER:=CONST(IF(TC2=1,H,REF(H,TC2-1)));BC1:=IF(L=LLV(L,8*LR),L,DRAWNULL);BC2:=CONST(BARSLAST(BC1=L))+1;LOWER:=CONST(IF(BC2=1,L,REF(L,BC2-1)));LP:=CURRBARSCOUNT<=BC2 AND L=LOWER;{低点定位}HP:=CURRBARSCOUNT<=TC2 AND H=UPPER;{高点定位}STICKLINE(IF(BC2>TC2,HP,LP),LOWER,UPPER,0,0),COLOR628962;STICKLINE(IF(BC2>TC2,LP,HP),LOWER,UPPER,0,0),COLOR628962;NOD:=(IF(TC2>BC2,TC2,BC2)-IF(TC2>BC2,BC2,TC2));{用时}LR1:=FORCAST(C,NOD+1);NP:IF(CURRBARSCOUNT<=MAX(BC2,TC2),CONST(IF(MIN(TC2,BC2)=1,LR1,REF(LR1,MI N(TC2,BC2)-1))),DRAWNULL),POINTDOT,COLOR93BDA8;{近点}LR2:=SLOPE(C,NOD+1);LR3:=CONST(IF(MIN(TC2,BC2)=1,LR2,REF(LR2,MIN(TC2,BC2)-1)));FP:NP-LR3*(NOD),POINTDOT,COLOR93BDA8;{远点}EQU:(NP+FP)/2,POINTDOT,COLOR93BDA8;AD:=ABS(NP-FP);{高差};DBL:=BARSLAST(BC1!=DRAWNULL)+1;DBH:=BARSLAST(TC1!=DRAWNULL)+1;BSP:=IF(BC2>TC2,DBL,DBH)-1;LRL:=IF(NP>FP,FP+AD/NOD*BSP,FP-AD/NOD*BSP);AT1:=IF(BETWEEN(CURRBARSCOUNT,BC2,TC2) AND H>LRL,H,LRL);AT2:=HHV(AT1-LRL,MAX(BC2,TC2));AT3:=CONST(BARSLAST(AT1-LRL=AT2));AT4:=CONST(IF(AT3=0,H,REF(H,AT3)));AT5:=CONST(IF(AT3=0,AT1-LRL,REF(AT1-LRL,AT3)));ATL:=LRL+AT5;UT1:=IF(BETWEEN(CURRBARSCOUNT,BC2,TC2) AND L<LRL,L,LRL);UT2:=HHV(LRL-UT1,MAX(BC2,TC2));UT3:=CONST(BARSLAST(LRL-UT1=UT2));UT4:=CONST(IF(UT3=0,H,REF(H,UT3)));UT5:=CONST(IF(UT3=0,LRL-UT1,REF(LRL-UT1,UT3)));UTL:=LRL-UT5;RH:=IF(CURRBARSCOUNT>=MIN(BC2,TC2)-10,ATL,CONST(REF(ATL,MIN(BC2,TC2)-11)) );{限制高}RL:=IF(CURRBARSCOUNT>=MIN(BC2,TC2)-10,UTL,CONST(REF(UTL,MIN(BC2,TC2)-11)) );{限制低}中轨:IF(NP>FP,IF(LRL<=RH,LRL,DRAWNULL),IF(LRL>=RL,LRL,DRAWNULL)),COLOR62896 2;上轨:IF(NP>FP,IF(ATL<=RH,ATL,DRAWNULL),IF(ATL>=RL,ATL,DRAWNULL)),COLOR62896 2;下轨:IF(NP>FP,IF(UTL<=RH,UTL,DRAWNULL),IF(UTL>=RL,UTL,DRAWNULL)),COLOR6289 62;MA1:=MA(CLOSE,5);DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);DEA:=EMA(DIF,9);TJ1:=BARSLAST(CROSS(DIF,DEA));TJ2:=REF(H,TJ1);IF(TJ1<30,TJ2,DRAWNULL),COLORGREEN,LINETHICK1;{30为横线延伸天数}IF(CROSS(DIF,DEA),H*1.005,DRAWNULL),CIRCLEDOT,COLORYELLOW,LINETHICK; STICKLINE(CROSS(DIF,DEA),H*1.0005,H*0.9995,7,0),COLORGREEN;ADD:=SUMBARS(V ,CAPITAL*1);{累计换手=100%的周期}A2:=SUM(COST(20),ADD)/ADD;{在A周期里获利20%的平均价}A1:=SUM(COST(10),ADD)/ADD;{在A周期里获利10%的平均价}A3D:=SUM(COST(30),ADD)/ADD;{在A周期里获利30%的平均价}A4D:=SUM(COST(40),ADD)/ADD;{在A周期里获利40%的平均价}A5D:=SUM(COST(50),ADD)/ADD;{在A周期里获利50%的平均价}E:=LLV(L,250)=L;{一年中最低价的位置}E1:=BARSLAST(E);{求得一年中最低价的位置到现在的周期}庄家成本:(5*A1+4*A2+3*A3D+2*A4D+A5D)/15, CIRCLEDOT,COLOR00FFFF;{求的启动点的价位}OK1:STICKLINE(CROSS(C,庄家成本) AND E1>=40 ,O ,C ,5 ,0 ),COLOR00FFFF;{得到启动点};A线:=HHV(H,20);B线:=LLV(L,20);C线:=(A线+B线)/2;做多线:IF(C线,C线,DRAWNULL)COLORFF00FF,LINETHICK2;。
通达信指标公式源码 六线通道主图指标源码
估:=(2*CLOSE+LOW+HIGH)/4;界:=SLOPE(CLOSE,21)*20+CLOSE;文:=EMA(估,40)*0.85;卖线:=EMA(估,55)*1.3;捞钱线:=EMA(估,55);保本线:=(捞钱线+文)/2;STICKLINE(C>=保本线AND REF(C,1)<保本线AND REF(C,2)>保本线,O,C,3,0),COLORRED;STICKLINE(C>=保本线AND REF(C,1)<保本线AND REF(C,2)>保本线,L,H,0.2,0),COLORRED;STICKLINE(FILTER(C>=捞钱线AND L<捞钱线,2),O,C,3,0),COLORYELLOW; STICKLINE(FILTER(C>=捞钱线AND L<捞钱线,2),L,H,0.2,0),COLORYELLOW; STICKLINE(FILTER(CROSS(卖线,CLOSE),3),O,C,3,0),COLORGREEN; STICKLINE(FILTER(CROSS(卖线,CLOSE),3),L,H,0.2,0),COLORGREEN; DRAWICON(C>=保本线AND REF(C,1)<保本线AND REF(C,2)>保本线,L*0.96,9);DRAWICON(FILTER(C>=捞钱线AND L<捞钱线,2),L*0.98,1); DRAWICON(FILTER(CROSS(卖线,CLOSE),3),H*1.03,2);V10日涨跌%:(C-REF(CLOSE,10))/REF(CLOSE,10)*100,COLORYELLOW,NODRAW;VAR1:=IF(DATE>=10211201,0,1);VAR2:=EMA(SLOPE(CLOSE,21)*20+CLOSE,55);VAR3:=EMA(CLOSE,3);VAR4:=(2*CLOSE+LOW+HIGH)/4*VAR1;VAR5:=VAR2-VAR3;风险线:EMA(VAR4,45)*1.15,COLORFFFF00;必卖线:EMA(VAR4,55)*1.3,POINTDOT,LINETHICK4;底线:EMA(VAR4,40)*0.85,COLORFF00FF;铁底线:EMA(VAR4,88)*0.7,POINTDOT,LINETHICK4,COLORGREEN;成本线:EMA(VAR4,55),COLORYELLOW;价值中枢: (成本线+底线)/2,COLORWHITE;DRAWTEXT(ISLASTBAR,风险线,'风险'),COLORFFFF00;DRAWTEXT(ISLASTBAR,必卖线,'必卖'),COLORYELLOW;DRAWTEXT(ISLASTBAR,底线,'安全'),COLORMAGENTA;DRAWTEXT(ISLASTBAR,铁底线,'铁底'),COLORYELLOW;DRAWTEXT(ISLASTBAR,成本线,'拉升'),COLORRED;DRAWTEXT(ISLASTBAR,价值中枢,'强弱'),COLORWHITE;AAPP:MA(MA(CLOSE,3),1),LINETHICK3,COLORGREEN;IF(AAPP>=REF(AAPP,1),AAPP,DRAWNULL),COLORFF00FF,LINETHICK3; XXS:=MA(HIGH,5)*(1+5/100);DRAWTEXT(CROSS(XXS,C),H*1.02,'开盘逃'),COLORYELLOW;LC:=REF(CLOSE,1);RSI:=((SMA(MAX((CLOSE - LC),0),3,1) / SMA(ABS((CLOSE - LC)),3,1)) * 100);FF:=EMA(CLOSE,2);MA15:=EMA(CLOSE,26);DRAWTEXT(CROSS(FF,MA15),(L OW * 0.999),'中继'),COLORA6E500;DRAWTEXT(CROSS(88,RSI),(HIGH * 1.02),'逃顶'),COLOR1880FF; STICKLINE(C/REF(C,1)>1.095,C,O,2,0),COLORYELLOW;XXS1:=MA(HIGH,5)*(1+5/100);DDDD:=CROSS(C,XXS1);DRAWTEXT(DDDD,HIGH*1.02,'明走'),COLORYELLOW;多头线:=EMA(C,1.5),COLOR0000CC;空头线:=EMA(C,5),COLORMAGENTA;均衡线:=EMA(空头线,5),COLORGREEN;VARF1:=COUNT(CROSS(多头线,均衡线),2)=1;VARF2:=COUNT(CROSS(空头线,均衡线),2)=1;ZAI:=FILTER(VARF1 AND VARF2,2);DRAWTEXT(ZAI,均衡线*0.99,'↖主力拉升'),COLOR00FF00;MA5:=MA(CLOSE,5);MA10:=MA(CLOSE,10);MA20:=MA(CLOSE,20);MA30:=MA(CLOSE,30);MA60:=MA(CLOSE,60);MA120:=MA(CLOSE,120),COLORLIBLUE;MA250:=MA(CLOSE,250),COLORBLUE;DRAWTEXT(CROSS(MA20,MA30),L,'牛相关注20'),COLORMAGENTA;DRAWTEXT(CROSS(MA30,MA60),L,'初生牛犊30'),COLORGREEN; DRAWTEXT(CROSS(MA60,MA120),L,'霸占大牛60'),COLORBLUE; DRAWTEXT(CROSS(MA120,MA250),L,'牛气冲天120'),COLORYELLOW;买进价:=((C-REF(MA(C,6),1))/6+MA(C,6))*1.004;买进条件:=CROSS(C,买进价) AND 买进价>REF(买进价,1);STICKLINE(买进条件,H,L,0,1),COLORWHITE,LINETHICK1;STICKLINE(买进条件,O,C,2.5,0),COLORWHITE,LINETHICK2;加码价:=((C-REF(MA(C,18),1))/18+MA(C,18))*1.004;加码条件:=CROSS(C,加码价) AND 加码价>REF(加码价,1);STICKLINE(加码条件,H,L,0,1),COLORYELLOW,LINETHICK2;STICKLINE(加码条件,O,C,1.5,0),COLORYELLOW,LINETHICK2;M1:=MA(CLOSE,13);A:=MA(C,5);DRAWTEXT(LAST(MA(C,5)<MA(C,10),5,0) AND "I">REF("I",1) AND CROSS("I",-100),L*0.99,'⊕底');DRAWTEXT(CROSS(A,M1),M1,'◣周加'),COLORWHITE;DRAWTEXT(A>=REF(A,1) AND REF(A,1)<REF(A,2),A,'◣周买'),COLORYELLOW;{周线上买入,中期持有,月线上更好};{PEAKBARS未来判断明日顶部,收市前指标不消失请逃顶}VAR3A:=PEAKBARS(3,15,1)<10;VAR5A:=IF(VAR3A=1,2,0);顶:= IF(VAR5A=2,2,0);顶A:=IF(顶>REF(顶,1),50,0);DRAWTEXT(顶A=50,H * 1.02,'逃命'),COLOR00FF00;T:=BARSLAST(L>REF(H,1));E:=COUNT(L<REF(H,T+1),T)<2;DRAWTEXT(L<REF(H,T+1 ) AND E,L*0.99,'缺口回补'),COLOR0099FF;Y:=CLOSE/REF(CLOSE,1)>1.07;X:=VOL>MA(VOL,5);A1:=Y AND X;DRAWTEXT(A1,L*0.999,'攻涨停'),COLORMAGENTA;Z:=CLOSE/REF(CLOSE,1)<0.93;W:=VOL<MA(VOL,5);A2:=Z AND W;DRAWTEXT(A2,H*1.01,'小心跌停'),COLORGREEN;B36:=MA(CLOSE,3) - MA(CLOSE,6);B612:=MA(CLOSE,6) - MA(CLOSE,12);J:=((B36)/(CLOSE))*(10);J1:=((B612)/(CLOSE))*(10);DRAWTEXT((J < (-0.2)) AND (J1 < (-0.2)) AND CROSS(J,J1),(LOW)*(0.999),'大牛'),COLORRED;。
通达信指标公式源码 画线波谷BS通道主图指标公式
天际: (MA(CLOSE,40)) + 2*STD(CLOSE,40),LINETHICK2,COLORBLUE;海底: (MA(CLOSE,40)) - 2*STD(CLOSE,40),LINETHICK2,COLORBLUE;买卖决策①:EXPMA(CLOSE,12),CIRCLEDOT,COLORWHITE;红持绿抛②:MA(CLOSE,25),COLORRED;红持绿抛③:MA(CLOSE,30),COLORGREEN;DRAWBAND(红持绿抛②,RGB(255,0,0),红持绿抛③,RGB(0,255,0));NOTEXT1:IF(CLOSE>买卖决策①AND CLOSE!=买卖决策①,买卖决策①,DRAWNULL),CIRCLEDOT,COLORRED;NOTEXT2:IF(CLOSE<买卖决策①AND CLOSE!=买卖决策①,买卖决策①,DRAWNULL),CIRCLEDOT,COLORGREEN;现价:=C,POINTDOT;M3:MA(C,3);持股13线:=EMA(CLOSE,13);突破77线:=EMA(CLOSE,77);翻锅99线:=EMA(CLOSE,99);DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);DEA:=EMA(DIF,9);AA:=EMA(CLOSE,10);多头:=STICKLINE(DIF>DEA,CLOSE,OPEN,2,0),COLORRED;STICKLINE(DIF>DEA,HIGH,LOW,0,0),COLORRED;空头:=STICKLINE(DIF<=DEA,CLOSE,OPEN,2,0),COLORGREEN;STICKLINE(DIF<=DEA,HIGH,LOW,0,0),COLORGREEN;STICKLINE(DIF<=DEA AND AA>MA(CLOSE,50),CLOSE,OPEN,2,0),COLORYELLOW; STICKLINE(DIF<=DEA AND AA>MA(CLOSE,50),HIGH,LOW,0,0),COLORYELLOW; DRAWTEXT(CROSS(DIF,DEA),LOW*0.995, 'B'),COLORYELLOW,LINETHICK3,; DRAWTEXT(CROSS(DEA,DIF),HIGH*1.02, 'S'),COLORGREEN,LINETHICK3,;A:=TROUGH(3,10,1);B:=TROUGHBARS(3,10,1)=0;画底线:DRAWLINE(B,A,B,A,1),COLORYELLOW;D:=PEAK(3,10,1);E:=PEAKBARS(3,10,1)=0;画顶线:DRAWLINE(E,D,E,D,1),COLOR00FF00;百分比:=10;{也可设立参数:百分比(5,30,10)}误差:=2;{误差百分比}允许误差:=误差/100+0.004;{也可设立参数:允许误差(0,0.02,0)} 波谷1距离:= 1+CONST(TROUGHBARS(2,百分比,1));波谷值1: CONST(TROUGH(2,百分比,1));波谷值2:= CONST(TROUGH(2,百分比,2));波谷值3:= CONST(TROUGH(2,百分比/2,2));波谷值4:= CONST(TROUGH(2,百分比*2,2));。
MACD背离自动画线通达信指标公式源码
MACD背离自动画线通达信指标公式源码MACD(Moving Average Convergence Divergence)是一种常用的股票技术指标,用于分析股票的趋势和交易信号。
MACD背离是一种常见的技术分析方法,用于判断趋势的反转点,即价格走势与MACD指标走势不一致的情况。
下面是使用通达信编写MACD背离自动画线指标的源码。
```c/*MACD背离自动画线指标*功能:自动识别MACD背离点并在图表中标注出来*/#include "stdafx.h"#include "stdio.h"#include "string.h"#include "windows.h"//确定最低点、最高点时使用的价格周期数#define MIN_PRICE_DURATION 9#define MAX_PRICE_DURATION 10/**输入参数:*MACD:一个包含MACD数据的数组* price:一个包含价格数据的数组*返回值:*0:没有背离*1:向上背离*-1:向下背离*/int CheckDivergence(float *MACD, float *price) int i, j, k;int start, end;int low_index, high_index;float min_price, max_price;int MACD_bottom, MACD_top;int price_bottom, price_top;float MACD_bottom_value, MACD_top_value;float price_bottom_value, price_top_value;/**阶段1:寻找MACD底背离*/start = MAX_PRICE_DURATION + 1;end = start + MIN_PRICE_DURATION;low_index = -1;high_index = -1;min_price = price[start];max_price = price[start];for (i = start; i < end; i++)//查找最低点if (price[i] < min_price)low_index = i;min_price = price[i];}//查找最高点if (price[i] > max_price)high_index = i;max_price = price[i];}}//无法找到底背离点if (low_index == -1 , high_index == -1)}MACD_bottom = 0;price_bottom = 0;//寻找MACD底背离for (i = start; i < end; i++)if (i == low_index)//找到最低点对应的MACD数值MACD_bottom = i;MACD_bottom_value = MACD[i];}if (i == high_index)//找到最高点对应的MACD数值price_bottom = i;price_bottom_value = price[i];}}//如果最低点出现在最高点之后,则没有底背离if (MACD_bottom > price_bottom)}/**阶段2:寻找MACD顶背离*/start = MAX_PRICE_DURATION + 1; end = start + MIN_PRICE_DURATION; low_index = -1;high_index = -1;min_price = price[start];max_price = price[start];for (i = start; i < end; i++)//查找最低点if (price[i] < min_price)low_index = i;min_price = price[i];}//查找最高点if (price[i] > max_price)max_price = price[i];}}//无法找到顶背离点if (low_index == -1 , high_index == -1) return 0;}MACD_top = 0;price_top = 0;//寻找MACD顶背离for (i = start; i < end; i++)if (i == low_index)//找到最低点对应的MACD数值MACD_top = i;MACD_top_value = MACD[i];}if (i == high_index)//找到最高点对应的MACD数值price_top_value = price[i];}}//如果最高点出现在最低点之后,则没有顶背离if (MACD_top > price_top)return 0;}//判断背离类型if (price_bottom_value < price_top_value && MACD_bottom_value > MACD_top_value)return 1; // 向上背离}if (price_bottom_value > price_top_value && MACD_bottom_value < MACD_top_value)return -1; // 向下背离}return 0;int mainfloat MACD[100] = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 4.0, 3.0, 2.0, 1.0};float price[100] = {1.0, 2.0, 3.0, 4.0, 3.0, 2.0, 1.0, 0.0, -1.0, -2.0};int result = CheckDivergence(MACD, price);printf("Result: %d\n", result);return 0;```该源码实现了一个简单的MACD背离自动画线指标。
通达信指标公式源码 自动画线主图指标公式
N1:=10;N2:=10;DISP:=2;K:=IF(PERIOD=5,1,{日}IF(PERIOD=6,1,{周}IF(PERIOD=7,1,{月}IF(PERIOD=8,1,{多分钟}IF(PERIOD=9,1,{多日}IF(PERIOD=10,1,{季}IF(PERIOD=11,2,{年}IF(PERIOD=4,1,{60F}IF(PERIOD=3,1,{30F}IF(PERIOD=2,1,{15F}IF(PERIOD=1,1{5F},1{1F})))))))))))/10;P1:=PEAK(1,K*N1,1);P2:=PEAK(1,K*N1,2);WP1:=PEAKBARS(1,K*N1,1);WP2:=PEAKBARS(1,K*N1,2);T1:=TROUGH(2,K*N2,1);T2:=TROUGH(2,K*N2,2);WT1:=TROUGHBARS(2,K*N2,1);WT2:=TROUGHBARS(2,K*N2,2);TJ1:=P1>T1 AND P2>T2 ;ZD:=MAX(T1,T2);ZG:=MIN(P1,P2);LL:=MIN(T1,T2);HH:=MAX(P1,P2);TJ2:=FILTER(ZG>ZD,2);TJ3:=ZG=REF(ZG,BARSLAST(TJ2)) OR ZD=REF(ZD,BARSLAST(TJ2));TJ4:=TJ1&&TJ2&&NOT(TJ3);TJ5:=BETWEEN(ZD,REF(ZD,REF(BARSLAST(TJ4),1)),REF(ZG,REF(BARSLAST( TJ4),1)));TJ6:=BETWEEN(ZG,REF(ZD,REF(BARSLAST(TJ4),1)),REF(ZG,REF(BARSLAST( TJ4),1)));TJ7:=ZG>REF(ZG,REF(BARSLAST(TJ4),1))&&ZD<REF(ZD,REF(BARSLAST(TJ4 ),1));TJ8:=TJ4&&NOT(TJ5 OR TJ6 OR TJ7);ZSD:=IF(TJ8,ZD,DRAWNULL);ZSG:=IF(TJ8,ZG,DRAWNULL);ZSH:=IF(TJ8,HH,DRAWNULL);ZSL:=IF(TJ8,LL,DRAWNULL);STICKLINE(TJ8,ZSH,ZSL,0,-1),COLORMAGENTA;STICKLINE(TJ8,ZSD,ZSG,IF(DISP=1,3,0),1),COLORMAGENTA; DRAWTEXT(DISP=2,ZSH,'中枢'),COLORWHITE;中枢高:=PLOYLINE(DISP=2,REF(ZSD,BARSLAST(TJ8))),CIRCLEDOT,COLORLIRED; 中枢低:=PLOYLINE(DISP=2,REF(ZSG,BARSLAST(TJ8))),CIRCLEDOT,COLORLIGRE EN;{中枢最高:PLOYLINE(DISP=2,REF(ZSH,BARSLAST(TJ8))),POINTDOT,COLORRED;中枢最低:PLOYLINE(DISP=2,REF(ZSL,BARSLAST(TJ8))),POINTDOT,COLORGREEN;} 趋势高:=PLOYLINE(DISP=3,ZIG(1,K*N1)),COLORLIBLUE;趋势低:=PLOYLINE(DISP=3,ZIG(2,K*N2)),COLORLIBLUE;局部低点预选A:=BACKSET(LLV(L,5)<REF(LLV(L,4),1),4);局部低点预选B:=BACKSET(局部低点预选A=0 AND REF(局部低点预选A,1)=1,2);局部低点预选C:=IF(局部低点预选B=1 AND REF(局部低点预选B,1)=0,-1,0); 局部高点预选A:=BACKSET(HHV(H,5)>REF(HHV(H,4),1),4);局部高点预选B:=BACKSET(局部高点预选A=0 AND REF(局部高点预选A,1)=1,2);局部高点预选C:=IF(局部高点预选B=1 AND REF(局部高点预选B,1)=0,1,0); 缺口判断:=IF(L>REF(H,1),1,IF(H<REF(L,1),-1,0));距前高天:=BARSLAST(局部高点预选C=1);距前低天:=BARSLAST(局部低点预选C=-1);小值周期:=LOWRANGE(L);大值周期:=TOPRANGE(H);低保留AA:=IF(局部低点预选C=-1 AND REF(距前高天,1)>REF(距前低天,1) AND LLV(L,距前高天+1)<REF(LLV(L,距前高天+1),1),-1,0);低保留AB:=IF(局部低点预选C=-1 AND REF(距前高天,1)<=REF(距前低天,1) AND (距前高天>=4 OR LLV(缺口判断,距前高天)=-1 OR LLV(L,距前低天+2)<REF(LLV(L,距前低天+1),1)),-1,0);低保留S:=IF((低保留AA=-1 OR 低保留AB=-1) AND L<REF(H,距前高天+1),-1,0);预判:=IF((距前低天<4 AND HHV(缺口判断,距前低天)!=1) OR REF(低保留S,距前低天)=0,1,0);判断:=IF(局部高点预选C=1 AND REF(距前低天,1)<=REF(距前高天,1) AND 预判=1 AND 大值周期>REF(小值周期,距前低天+1) AND 大值周期>REF(小值周期,距前低天) AND 大值周期>REF(大值周期,距前高天),1,0);高保留A:=IF(局部高点预选C=1 AND REF(距前低天,1)>REF(距前高天,1) AND HHV(H,距前低天+1)>REF(HHV(H,距前低天+1),1),1,0);高保留B:=IF(局部高点预选C=1 AND REF(距前低天,1)<=REF(距前高天,1) AND REF(低保留S,距前低天)=-1 AND (距前低天>=4 OR HHV(缺口判断,距前低天)=1),1,0);高保留:=IF((高保留A=1 OR 高保留B=1 OR 判断=1) AND H>REF(L,距前低天+1),1,0);预判A:=IF((距前高天<4 AND HHV(缺口判断,距前高天)!=1) OR REF(高保留,距前高天)=0,1,0);判断A:=IF(局部低点预选C=-1 AND REF(距前高天,1)<=REF(距前低天,1) AND 预判A=1 AND 小值周期>REF(大值周期,距前高天+1) AND 小值周期>REF(大值周期,距前高天) AND 小值周期>REF(小值周期,距前低天),-1,0);低保留A:=IF(局部低点预选C=-1 AND REF(距前高天,1)>REF(距前低天,1) AND LLV(L,距前高天+1)<REF(LLV(L,距前高天+1),1),-1,0);低保留B:=IF(局部低点预选C=-1 AND REF(距前高天,1)<=REF(距前低天,1) AND (距前高天>=4 OR LLV(缺口判断,距前高天)=-1 OR 判断A=-1),-1,0);低保留:=IF((低保留A=-1 OR 低保留B=-1) AND L<REF(H,距前高天+1),-1,0); 距前高天A:=BARSLAST(高保留=1);距前低天A:=BARSLAST(低保留=-1);预判X:=IF((距前低天A<4 AND HHV(缺口判断,距前低天A)!=1) OR REF(低保留,距前低天A)=0,1,0);判断X:=IF(局部高点预选C=1 AND REF(距前低天A,1)<=REF(距前高天A,1) AND 预判X=1 AND 大值周期>REF(小值周期,距前低天A+1) AND 大值周期>REF(小值周期,距前低天A) AND 大值周期>REF(大值周期,距前高天A),1,0); 高保留XA:=IF(局部高点预选C=1 AND REF(距前低天A,1)>REF(距前高天A,1) AND HHV(H,距前低天A+1)>REF(HHV(H,距前低天A+1),1),1,0);高保留XB:=IF(局部高点预选C=1 AND REF(距前低天A,1)<=REF(距前高天A,1) AND REF(低保留,距前低天A)=-1 AND (距前低天A>=4 OR HHV(缺口判断,距前低天A)=1),1,0);高保留X:=IF((高保留XA=1 OR 高保留XB=1 OR 判断X=1) AND H>REF(L,距前低天A+1),1,0);预判XA:=IF((距前高天A<4 AND HHV(缺口判断,距前高天A)!=1) OR REF(高保留XA,距前高天A)=0,1,0);判断XA:=IF(局部低点预选C=-1 AND REF(距前高天A,1)<=REF(距前低天A,1) AND 预判XA=1 AND 小值周期>REF(大值周期,距前高天A+1) AND 小值周期>REF(大值周期,距前高天A) AND 小值周期>REF(小值周期,距前低天A),-1,0); 低保留XA:=IF(局部低点预选C=-1 AND REF(距前高天A,1)>REF(距前低天A,1) AND LLV(L,距前高天A+1)<REF(LLV(L,距前高天A+1),1),-1,0);低保留XB:=IF(局部低点预选C=-1 AND REF(距前高天A,1)<=REF(距前低天A,1) AND (距前高天A>=4 OR LLV(缺口判断,距前高天A)=-1 OR 判断XA=-1),-1,0);低保留X:=IF((低保留XA=-1 OR 低保留XB=-1) AND L<REF(H,距前高天A+1),-1,0);距前高天YA:=BARSLAST(高保留X=1);距前低天YA:=BARSLAST(低保留X=-1);预判YX:=IF((距前低天YA<4 AND HHV(缺口判断,距前低天YA)!=1) OR REF(低保留X,距前低天YA)=0,1,0);判断YX:=IF(局部高点预选C=1 AND REF(距前低天YA,1)<=REF(距前高天YA,1) AND 预判YX=1 AND 大值周期>REF(小值周期,距前低天YA+1) AND 大值周期>REF(小值周期,距前低天YA) AND 大值周期>REF(大值周期,距前高天YA),1,0);高保留YXA:=IF(局部高点预选C=1 AND REF(距前低天YA,1)>REF(距前高天YA,1) AND HHV(H,距前低天YA+1)>REF(HHV(H,距前低天YA+1),1),1,0);高保留YXB:=IF(局部高点预选C=1 AND REF(距前低天YA,1)<=REF(距前高天YA,1) AND REF(低保留X,距前低天YA)=-1 AND (距前低天YA>=4 OR HHV(缺口判断,距前低天YA)=1),1,0);高保留YX:=IF((高保留YXA=1 OR 高保留YXB=1 OR 判断YX=1) ANDH>REF(L,距前低天YA+1),1,0);预判YXA:=IF((距前高天YA<4 AND HHV(缺口判断,距前高天YA)!=1) ORREF(高保留YXA,距前高天YA)=0,1,0);判断YXA:=IF(局部低点预选C=-1 AND REF(距前高天YA,1)<=REF(距前低天YA,1) AND 预判YXA=1 AND 小值周期>REF(大值周期,距前高天YA+1) AND小值周期>REF(大值周期,距前高天YA) AND 小值周期>REF(小值周期,距前低天YA),-1,0);低保留YXA:=IF(局部低点预选C=-1 AND REF(距前高天YA,1)>REF(距前低天YA,1) AND LLV(L,距前高天YA+1)<REF(LLV(L,距前高天YA+1),1),-1,0);低保留YXB:=IF(局部低点预选C=-1 AND REF(距前高天YA,1)<=REF(距前低天YA,1) AND (距前高天YA>=4 OR LLV(缺口判断,距前高天YA)=-1 OR 判断YXA=-1),-1,0);低保留YX:=IF((低保留YXA=-1 OR 低保留YXB=-1) AND L<REF(H,距前高天YA+1),-1,0);AAAD:=IF(高保留YX=1 AND 低保留YX=-1 AND H>REF(H,REF(距前高天YA,1)+2),1,IF(高保留YX=1 AND 低保留YX=-1 AND L<REF(L,REF(距前低天YA,1)+2),-1,0));极点保留:=IF(AAAD=0,高保留YX+低保留YX,AAAD);局部极点:=IF(极点保留=-1,L,IF(极点保留=1,H,DRAWNULL)) CIRCLEDOT COLORYELLOW;{大折线}A1:=REF(HIGH,10)=HHV(HIGH,2*10+1);B1:=FILTER(A1,10);C1:=BACKSET(B1,10+1);D1:=FILTER(C1,10);{高点}A2:=REF(LOW,10)=LLV(LOW,2*10+1);B2:=FILTER(A2,10);C2:=BACKSET(B2,10+1);D2:=FILTER(C2,10);{低点}E1:=(REF(LLV(LOW,2*10),1)+REF(HHV(HIGH,2*10),1))/2;E2:=(HIGH+LOW)/2;H1:=(D1 AND NOT((D2 AND E1>=E2))) OR ISLASTBAR OR BARSCOUNT(CLOSE)=1;L1:=(D2 AND NOT((D1 AND E1<E2)));H2:=D1 AND NOT((D2 AND E1>=E2));X1:=REF(BARSLAST(H1),1)+1;F1:=BACKSET(H1 AND COUNT(L1,X1)>0,LLVBARS(IF(L1,LOW,10000),X1)); G1:=F1>REF(F1,1);I1:=BACKSET(G1,2);LD:=I1>REF(I1,1);{过滤后低点}L2:=LD OR ISLASTBAR OR BARSCOUNT(CLOSE)=1;X2:=REF(BARSLAST(L2),1)+1;F2:=BACKSET(L2 AND COUNT(H2,X2)>0,HHVBARS(IF(H2,HIGH,0),X2));G2:=F2>REF(F2,1);I2:=BACKSET(G2,2);HD:=I2>REF(I2,1);{过滤后高点}DRAWLINE(LD,L,HD,H,0),COLORMAGENTA,DOTLINE,LINETHICK1; DRAWLINE(HD,H,LD,L,0),COLORMAGENTA,DOTLINE,LINETHICK1;J1:=BACKSET(ISLASTBAR ,MIN(BARSLAST(HD),BARSLAST(LD))+1);J2:=J1>REF(J1,1);DRAWLINE(J2,IF(HD,H,L),ISLASTBAR ,IF(BARSLAST(HD)>BARSLAST(LD),H,L ),0),COLORWHITE,LINETHICK1;{趋势线}UU:=BACKSET(ISLASTBAR,BARSLAST(LD)+1);VV:=UU>REF(UU,1);WW:=BACKSET(VV,REF(BARSLAST(LD),1)+2);XX:=WW>REF(WW,1);DRAWLINE(XX,L,VV,L,1),COLORRED,LINETHICK2;UU2:=BACKSET(ISLASTBAR,BARSLAST(HD)+1);VV2:=UU2>REF(UU2,1);WW2:=BACKSET(VV2,REF(BARSLAST(HD),1)+2);XX2:=WW2>REF(WW2,1);DRAWLINE(XX2,H,VV2,H,1),COLORGREEN,LINETHICK2;。
通达信指标公式源码顶底趋势主图画线指标
顶底趋势主图画线指标N:=3;A1:=REF(H,N)=HHV(H,2*N+1);B1:=FILTER(A1,N);C1:=BACKSET(B1,N+1);D1:=FILTER(C1,N);{高点}A2:=REF(L,N)=LLV(L,2*N+1);B2:=FILTER(A2,N);C2:=BACKSET(B2,N+1);D2:=FILTER(C2,N);{低点}E1:=(REF(LLV(L,2*N),1)+REF(HHV(H,2*N),1))/2;E2:=(H+L)/2;{高低点出现在同一K线上时可作取舍}H1:=(D1 AND NOT(D2 AND E1>=E2)) OR ISLASTBAR OR BARSCOUNT(C)=1; L1:=(D2 AND NOT(D1 AND E1<E2));H2:=D1 AND NOT(D2 AND E1>=E2);X1:=REF(BARSLAST(H1),1)+1;F1:=BACKSET(H1 AND COUNT(L1,X1)>0,LLVBARS(IF(L1,L,10000),X1));G1:=F1>REF(F1,1);I1:=BACKSET(G1,2);LD:=I1>REF(I1,1),LINETHICK0;{过滤后低点}L2:=LD OR ISLASTBAR OR BARSCOUNT(C)=1;X2:=REF(BARSLAST(L2),1)+1;F2:=BACKSET(L2 AND COUNT(H2,X2)>0,HHVBARS(IF(H2,H,0),X2));G2:=F2>REF(F2,1);I2:=BACKSET(G2,2);HD:=I2>REF(I2,1),LINETHICK0;{过滤后高点}R1:=BACKSET(ISLASTBAR,BARSLAST(HD)+1);S1:=R1>REF(R1,1);{前一高}T1:=BACKSET(ISLASTBAR,BARSLAST(LD)+1);U1:=T1>REF(T1,1);{前一低}R2:=BACKSET(S1,REF(BARSLAST(HD),1)+2);S2:=R2>REF(R2,1);{前二高}T2:=BACKSET(U1,REF(BARSLAST(LD),1)+2);U2:=T2>REF(T2,1);{前二低}T3:=BACKSET(U2,REF(BARSLAST(LD),1)+2);U3:=T3>REF(T3,1);{前三低}T4:=BACKSET(U3,REF(BARSLAST(LD),1)+2);U4:=T4>REF(T4,1);{前四低}R3:=BACKSET(S2,REF(BARSLAST(HD),1)+2);S3:=R3>REF(R3,1);{前三高}R4:=BACKSET(S3,REF(BARSLAST(HD),1)+2);S4:=R4>REF(R4,1);{前四高}★压力1:DRAWLINE(S2,H,S1,H,1),COLORMAGENTA,LINETHICK1; ★支撑1:DRAWLINE(U2,L,U1,L,1),COLOR8FBC8F,LINETHICK1;★压力2:DRAWLINE(S3,H,S2,H,1),COLORFF8000;★支撑2:DRAWLINE(U3,L,U2,L,1),COLOR99CC32;★压力3:DRAWLINE(S4,H,S3,H,1),COLOR0000FF;★支撑3:DRAWLINE(U4,L,U3,L,1),COLOR00FF7F; DRAWICON(S2,H*1.01,10);DRAWICON(S3,H*1.01,10);DRAWNUMBER(S2,H*1.02,H),COLORCFB53B; DRAWNUMBER(S1,H*1.02,H),COLORCFB53B; DRAWNUMBER(S3,H*1.02,H),COLORCFB53B;DRAWICON(U1,L*0.99,11);DRAWICON(U2,L*0.99,11);DRAWICON(U3,L*0.99,11);DRAWICON(U4,L*0.99,11);DRAWNUMBER(U1,L*0.98,L),COLORCYAN;DRAWNUMBER(U2,L*0.98,L),COLORCYAN;DRAWNUMBER(U3,L*0.98,L),COLORCYAN;DRAWNUMBER(U4,L*0.98,L),COLORCYAN;。
通达信指标公式源码 今天倍量到以前大于今天量向前画横线
添加说明:1、添加了地量【成交量柱体里绿色柱体显示】;2、地量的5倍成交量【成交量柱体中间的黄柱体显示】;3、5倍地量开始在5倍地量处向右画绿色横线【只显示最后一根】;4、倍量【成交量柱体里的绿色或红色细柱体显示】;源码:TOTAL:=IF(PERIOD=1,5,IF(PERIOD=2,15,IF(PERIOD=3,30,IF(PERIOD=4,60, IF(PERIOD=5,240,1)))));MTIME:=MOD(FROMOPEN,TOTAL);CTIME:=IF(MTIME<0.5,TOTAL,MTIME);VVOL:=IF(CURRBARSCOUNT=1,VOL*TOTAL/CTIME,DRAWNULL),NODRAW; STICKLINE(CURRBARSCOUNT=1 && (SETCODE=0 ||SETCODE=1),VVOL,0,-1,-1),COLOR00C0C0;AT:=IF(CAPITAL=0,AMOUNT/100000000,(VOL)/CAPITAL*100);ATM1:=EMA(AT,5);ATM2:=MA(AT,13);阶段地量:=AT<REF(LLV(AT,25),1) && ATM1<ATM2;XX:=BARSLAST(阶段地量);II:=DRAWLINE(阶段地量,VOL*5,ISLASTBAR,REF(VOL*5,XX),1);成交量:VOL,VOLSTICK;五倍地量:IF(CROSS(COUNT(CROSS(VOL>REF(VOL*5,XX),0.5),XX)=1,0.5),V,0),NOD RAW;STICKLINE(阶段地量,V*(3/10),V*(6/10),1.38,1),COLOR009900; STICKLINE(阶段地量,V*(3/10),V*(6/10),0.15,0),COLOR00FF00;五倍地量线:DRAWLINE(五倍地量,II,REF(五倍地量,1),REF(II,1),1),COLORGREEN;倍量:=V>REF(V,1)*2;N:=BARSLAST(倍量);常数:=CONST(IF(N=0,V,REF(V,N)));GG:=C>O;STICKLINE((倍量AND GG) OR (C>REF(C,1) AND C=O AND 倍量),0,V,0,0),COLORGREEN;阴线:=C<O;STICKLINE((倍量AND 阴线) OR (C<REF(C,1) AND C=O AND 倍量),0,V,0,0),COLORRED;STICKLINE(CROSS(COUNT(CROSS(VOL>REF(VOL*5,XX),0.5),XX)=1,0.5),V*(3/10),V*(6/10),1,0),COLORYELLOW;备注:=REFX(CROSS(常数,V),1);最后倍量:IF(IF(倍量,V,0)=REFX(REF(V,BARSLAST(倍量)),BARSNEXT(ISLASTBAR)),1,0),NODRAW;TT:=BARSLAST(备注);TS:=IF(ISLASTBAR AND 最后倍量,REF(TT,1)+1,TT);条件:=IF(备注,V,0)=REFX(REF(V,TS),BARSNEXT(倍量));天:=BARSLAST(条件);倍量横线:IF(天<=REFX(REF(BARSNEXT(最后倍量),天),最后倍量), DRAWLINE(条件,常数,ISLASTBAR,常数,1),DRAWNULL),COLORYELLOW,DOTLINE;天数:IF(ISLASTBAR AND 最后倍量=1,REF(天,1)+1,IF(倍量横线,天,DRAWNULL)),COLORRED,NODRAW;DRAWNUMBER(最后倍量=1,V,天数);。
MACD背离自动画线通达信指标公式源码
DIF:MACD.DIF(12,26,9),LINETHICK2;DEA:MACD.DEA(12,26,9);MACD:(DIF-DEA)*2,COLORSTICK;DRAWICON(REF(DIF,1)>REF(DIF,2) AND DIF<REF(DIF,1) AND DIF>0 AND DIF>DEA,DIF*1.1,2),COLORGREEN;DRAWICON(CROSS(DEA,DIF) AND DIF>0,DIF,37),COLORGREEN;DRAWICON(REF(DIF,1)<REF(DIF,2) AND DIF>REF(DIF,1) AND DIF<0 AND DIF<DEA,DIF*1.1,1),COLORRED;DRAWICON(CROSS(DIF,DEA) AND DIF<0,DIF,36),COLORRED;XA_1:=MACD<0 AND MACD>REF(MACD,1) AND REF(MACD,1)<REF(MACD,2) AND REF(MACD,2)<REF(MACD,3) AND REF(MACD,3)<REF(MACD,4);STICKLINE(XA_1,0,MACD,0.3,0),COLORRED;XA_2:=MACD>0 AND MACD<REF(MACD,1) AND REF(MACD,1)>REF(MACD,2) AND REF(MACD,2)>REF(MACD,3) AND REF(MACD,3)>REF(MACD,4);STICKLINE(XA_2,0,MACD,0.3,0),COLORGREEN;XA_3:=100-100*(HHV(HIGH,34)-CLOSE)/(HHV(HIGH,34)-LLV(LOW,34))-50;XA_4:=EMA(XA_3,3);NOTEXTLU:IF(XA_4>24.99,DIF,DRAWNULL),COLORRED,LINETHICK2;NOTEXTLU2:IF(XA_4<(-40.009998),DIF,DRAWNULL),COLORGREEN,LINETHICK2; NOTEXT0:0,DOTLINE,COLORLIGRAY;XA_5:=IF(PERIOD=0,0.7,IF(PERIOD=1,1.2,IF(PERIOD=2,2,IF(PERIOD=3,2.5,IF(PERIOD =4,3,IF(PERIOD=5,5.5,IF(PERIOD=6,6,IF(PERIOD=7,7,IF(PERIOD=8,3.5,4)))))))));XA_6:=BARSLAST(CROSS(MACD,0));XA_7:=REF(XA_6,1)>0 AND XA_6=0;XA_8:=BARSLAST(XA_7);XA_9:=REF(XA_6,XA_8+1);XA_10:=HHVBARS(MACD,XA_8+XA_9);XA_11:=IF(XA_10>XA_8,REF(MACD,XA_10),0);XA_12:=IF(XA_10>XA_8,REF(HIGH,XA_10),0);XA_13:=IF(REF(HIGH,1)=HHV(HIGH,XA_8+XA_9),REF(HIGH,1),0);XA_14:=(XA_13-XA_12)/XA_12*100;XA_15:=COUNT(CROSS(0,MACD),XA_8+XA_9);XA_16:=MACD>0 AND MACD<XA_11 AND HIGH=HHV(HIGH,XA_8+XA_9) AND XA_11>0 AND XA_15=1;XA_17:=REF(XA_16,1) AND HIGH<REF(HIGH,1) AND MACD>0 AND XA_11>0;XA_18:=LLVBARS(MACD,XA_8+XA_9);XA_19:=IF(XA_18>XA_8,REF(MACD,XA_18),0);XA_20:=IF(XA_18>XA_8,REF(LOW,XA_18),0);XA_21:=IF(REF(LOW,1)=LLV(LOW,XA_8+XA_9),REF(LOW,1),0);XA_22:=(XA_20-XA_21)/XA_20*100;XA_23:=COUNT(CROSS(MACD,0),XA_8+XA_9);XA_24:=MACD<0 AND MACD>XA_19 AND LOW=LLV(LOW,XA_8+XA_9) AND XA_19<0 AND COUNT(CROSS(MACD,0),XA_8+XA_9)<=3;XA_25:=REF(XA_24,1) AND LOW>REF(LOW,1) AND MACD<0 AND XA_19<0;前高:IF(XA_17,XA_12,DRAWNULL),NODRAW,COLOR7FFF00;现高:IF(XA_17,XA_13,DRAWNULL),NODRAW,COLORGREEN;幅度_顶:IF(XA_17,XA_14,DRAWNULL),NODRAW,COLORYELLOW;原低:IF(XA_25,XA_20,DRAWNULL),NODRAW,COLORLIMAGENTA;现低:IF(XA_25,XA_21,DRAWNULL),NODRAW,COLORRED;幅度_底:IF(XA_25,XA_22,0),NODRAW,COLORYELLOW;DRAWICON(XA_25,MACD,26);DRAWICON(XA_17,MACD,27);XA_26:=BACKSET(XA_17,XA_10+1);XA_27:=BACKSET(XA_25,XA_18+1);NOTEXTMACDL:DRAWLINE(REF(XA_27,1)=0 AND XA_27=1 AND MACD<0,MACD,XA_25,MACD,0),COLORRED;NOTEXTMACDH:DRAWLINE(REF(XA_26,1)=0 AND XA_26=1 AND MACD>0,MACD,XA_17,MACD,0),COLORGREEN;涨家数:INDEXADV,NODRAW,COLORRED;跌家数:INDEXDEC,NODRAW,COLORGREEN;正量能:涨家数/(涨家数+跌家数)*100,NODRAW,COLORMAGENTA;负量能:跌家数/(涨家数+跌家数)*100,NODRAW,COLORYELLOW;。
通达信指标公式源码精准画线公式
N1:=20;N2:=10;N3:=5;AA:=REF(H,N1)=HHV(H,2*N1+1);QY:=BACKSET(AA,N1+1);CC:=FILTER(QY,N1) AND H=HHV(H,N1+1);DDD:=BARSLAST(CC);GDTS:=IF(CC,CURRBARSCOUNT,0);DINGBU:=IF(DDD,REF(H,DDD),H);{顶部}DINGBUTS:=IF(DDD,REF(GDTS,DDD),GDTS);DINGBU1:=REF(DINGBU,DDD+1);GDCS1:=CONST(DINGBUTS);DINGBUTS1:=REF(DINGBUTS,DDD+1);GDCS2:=CONST(DINGBUTS1);DINGBU2:=REF(DINGBU1,DDD+1);MM:=IF(CURRBARSCOUNT>GDCS2,0,1);{DRAWLINE(CURRBARSCOUNT=GDCS2,H,ISLASTBAR,REF(H,GDCS2-1),1),CO LOR0055FF,POINTDOT,LINETHICK2;DRAWLINE(CURRBARSCOUNT=GDCS1,H,ISLASTBAR,REF(H,GDCS1-1),1),COL ORYELLOW,POINTDOT,LINETHICK2;}AA1:=REF(L,N1)=LLV(L,2*N1+1);QY1:=BACKSET(AA1,N1+1);CC1:=FILTER(QY1,N1) AND L=LLV(L,N1+1);DD1:=BARSLAST(CC1);DDTS:=IF(CC1,CURRBARSCOUNT,0);YDB:=IF(DD1,REF(L,DD1),L);DDTS1:=IF(DD1,REF(DDTS,DD1),DDTS);DDCS1:=CONST(DDTS1);ZDB:=REF(YDB,DD1+1);DDTS2:=REF(DDTS1,DD1+1);DDCS2:=CONST(DDTS2);{DRAWLINE(CURRBARSCOUNT=DDCS2,L,ISLASTBAR,REF(L,DDCS2-1),1),COLOR0055FF,POINTDOT,LINETHICK2;DRAWLINE(CURRBARSCOUNT=DDCS1,L,ISLASTBAR,REF(L,DDCS1-1),1),COL ORYELLOW,POINTDOT,LINETHICK2;}LAA:=REF(H,N2)=HHV(H,2*N2+1);LQY:=BACKSET(LAA,N2+1);LCC:=FILTER(LQY,N2) AND H=HHV(H,N2+1);LDDD:=BARSLAST(LCC);LGDTS:=IF(LCC,CURRBARSCOUNT,0);LDINGBU:=IF(LDDD,REF(H,LDDD),H);{顶部}LDINGBUTS:=IF(LDDD,REF(LGDTS,LDDD),LGDTS);LDINGBU1:=REF(LDINGBU,LDDD+1);LGDCS1:=CONST(LDINGBUTS);LDINGBUTS1:=REF(LDINGBUTS,LDDD+1);LGDCS2:=CONST(LDINGBUTS1);LDINGBU2:=REF(LDINGBU1,LDDD+1);LMM:=IF(CURRBARSCOUNT>LGDCS2,0,1);{DRAWLINE(CURRBARSCOUNT=LGDCS2,H,ISLASTBAR,REF(H,LGDCS2-1),1), COLOR0055FF,POINTDOT;DRAWLINE(CURRBARSCOUNT=LGDCS1,H,ISLASTBAR,REF(H,LGDCS1-1),1),C OLORYELLOW,POINTDOT;}LAA1:=REF(L,N2)=LLV(L,2*N2+1);LQY1:=BACKSET(LAA1,N2+1);LCC1:=FILTER(LQY1,N2) AND L=LLV(L,N2+1);LDD1:=BARSLAST(LCC1);LDDTS:=IF(LCC1,CURRBARSCOUNT,0);LYDB:=IF(LDD1,REF(L,LDD1),L);LDDTS1:=IF(LDD1,REF(LDDTS,LDD1),LDDTS);LDDCS1:=CONST(LDDTS1);LZDB:=REF(LYDB,LDD1+1);LDDTS2:=REF(LDDTS1,DD1+1);LDDCS2:=CONST(LDDTS2);DDYL2:=DRAWLINE(CURRBARSCOUNT=LGDCS2,H,CURRBARSCOUNT=LGDC S1,H,1) COLORWHITE;DDZC2:=DRAWLINE(CURRBARSCOUNT=LDDCS2,L,CURRBARSCOUNT=LDDC S1,L,1) COLORWHITE;ZGSTAR:=(DDYL2+DDZC2)/2;ZGEND:=CONST((DDYL2+DDZC2)/2);STARDAY:=IF(DDCS2<GDCS2,DDCS2,GDCS2);LLAA:=REF(H,N3)=HHV(H,2*N3+1);LLQY:=BACKSET(LLAA,N3+1);LLCC:=FILTER(LLQY,N3) AND H=HHV(H,N3+1);LLDDD:=BARSLAST(LLCC);LLGDTS:=IF(LLCC,CURRBARSCOUNT,0);LLDINGBU:=IF(LLDDD,REF(H,LLDDD),H);{顶部}LLDINGBUTS:=IF(LLDDD,REF(LLGDTS,LLDDD),LLGDTS);LLDINGBU1:=REF(LLDINGBU,LLDDD+1);LLGDCS1:=CONST(LLDINGBUTS);LLDINGBUTS1:=REF(LLDINGBUTS,LLDDD+1);LLGDCS2:=CONST(LLDINGBUTS1);LLDINGBU2:=REF(LLDINGBU1,LLDDD+1);LLMM:=IF(CURRBARSCOUNT>LGDCS2,0,1);{DRAWLINE(CURRBARSCOUNT=LLGDCS2,H,ISLASTBAR,REF(H,LLGDCS2-1),1 ),COLOR0055FF,POINTDOT;DRAWLINE(CURRBARSCOUNT=LLGDCS1,H,ISLASTBAR,REF(H,LLGDCS1-1),1) ,COLORYELLOW,POINTDOT;}LLAA1:=REF(L,N3)=LLV(L,2*N3+1);LLQY1:=BACKSET(LLAA1,N3+1);LLCC1:=FILTER(LLQY1,N3) AND L=LLV(L,N3+1);LLDD1:=BARSLAST(LCC1);LLDDTS:=IF(LLCC1,CURRBARSCOUNT,0);LLYDB:=IF(LLDD1,REF(L,LLDD1),L);LLDDTS1:=IF(LLDD1,REF(LLDDTS,LLDD1),LDDTS);LLDDCS1:=CONST(LLDDTS1);LLZDB:=REF(LLYDB,LLDD1+1);LLDDTS2:=REF(LLDDTS1,DD1+1);LLDDCS2:=CONST(LLDDTS2);GDYL3:=DRAWLINE(CURRBARSCOUNT=LLGDCS2,H,CURRBARSCOUNT=LLG DCS1,H,1) COLORYELLOW;DDZC3:=DRAWLINE(CURRBARSCOUNT=LLDDCS2,L,CURRBARSCOUNT=LLDD CS1,L,1) COLORYELLOW;LZGSTAR:=(GDYL3+DDZC3)/2;LZGEND:=CONST((GDYL3+DDZC3)/2);LSTARDAY:=IF(LLDDCS2<LLGDCS2,LLDDCS2,LLGDCS2);GDYL1:=DRAWLINE(CURRBARSCOUNT=GDCS2,H,CURRBARSCOUNT=GDCS1 ,H,1) COLORRED;DDZC1:=DRAWLINE(CURRBARSCOUNT=DDCS2,L,CURRBARSCOUNT=DDCS1, L,1) COLORRED;长线压力:DDZC1+(GDYL1-DDZC1)*0.809,COLORRED;长线支撑:DDZC1+(GDYL1-DDZC1)*0.191,COLORRED;中线压力:DDZC2+(DDYL2-DDZC2)*0.809,COLORGREEN;中线支撑:DDZC2+(DDYL2-DDZC2)*0.191,COLORGREEN;短线压力:DDZC3+(GDYL3-DDZC3)*0.809,COLORBLUE;短线支撑:DDZC3+(GDYL3-DDZC3)*0.191,COLORBLUE;L中轨:DRAWLINE(CURRBARSCOUNT=LSTARDAY,LZGSTAR,ISLASTBAR,LZGEND,1 ),COLORYELLOW;中轨:DRAWLINE(CURRBARSCOUNT=STARDAY,ZGSTAR,ISLASTBAR,ZGEND,1),COLORWHITE;长GDYL:DRAWLINE(CURRBARSCOUNT=GDCS2,H,CURRBARSCOUNT=GDCS1,H, 1) COLORRED,POINTDOT;长DDZC:DRAWLINE(CURRBARSCOUNT=DDCS2,L,CURRBARSCOUNT=DDCS1,L, 1) COLORRED,POINTDOT;中DDYL:DRAWLINE(CURRBARSCOUNT=LGDCS2,H,CURRBARSCOUNT=LGDCS1, H,1) COLORWHITE,POINTDOT;中DDZC:DRAWLINE(CURRBARSCOUNT=LDDCS2,L,CURRBARSCOUNT=LDDCS1, L,1) COLORWHITE,POINTDOT;短GDYL:DRAWLINE(CURRBARSCOUNT=LLGDCS2,H,CURRBARSCOUNT=LLGDCS 1,H,1) COLORYELLOW,POINTDOT;短DDZC:DRAWLINE(CURRBARSCOUNT=LLDDCS2,L,CURRBARSCOUNT=LLDDCS 1,L,1) COLORYELLOW,POINTDOT;。
通达信指标公式源码数浪画线主图 自动画通道
{自动画通道源码:N:2,200,13;UR:2,200,6;LR:2,200,6}TC1:=IF(H=HHV(H,8*UR),H,DRAWNULL);TC2:=CONST(BARSLAST(TC1=H))+1;UPPER:=CONST(IF(TC2=1,H,REF(H,TC2-1)));BC1:=IF(L=LLV(L,8*LR),L,DRAWNULL);BC2:=CONST(BARSLAST(BC1=L))+1;LOWER:=CONST(IF(BC2=1,L,REF(L,BC2-1)));LP:=CURRBARSCOUNT<=BC2 AND L=LOWER;{低点定位}HP:=CURRBARSCOUNT<=TC2 AND H=UPPER;{高点定位}STICKLINE(IF(BC2>TC2,HP,LP),LOWER,UPPER,0,0),COLOR628962; STICKLINE(IF(BC2>TC2,LP,HP),LOWER,UPPER,0,0),COLOR628962; NOD:=(IF(TC2>BC2,TC2,BC2)-IF(TC2>BC2,BC2,TC2));{用时}LR1:=FORCAST(C,NOD+1);NP:IF(CURRBARSCOUNT<=MAX(BC2,TC2),CONST(IF(MIN(TC2,BC2)=1,LR1,R EF(LR1,MIN(TC2,BC2)-1))),DRAWNULL),POINTDOT,COLOR93BDA8;{近点} LR2:=SLOPE(C,NOD+1);LR3:=CONST(IF(MIN(TC2,BC2)=1,LR2,REF(LR2,MIN(TC2,BC2)-1)));FP:NP-LR3*(NOD),POINTDOT,COLOR93BDA8;{远点}EQU:(NP+FP)/2,POINTDOT,COLOR93BDA8;AD:=ABS(NP-FP);{高差};DBL:=BARSLAST(BC1!=DRAWNULL)+1;DBH:=BARSLAST(TC1!=DRAWNULL)+1;BSP:=IF(BC2>TC2,DBL,DBH)-1;LRL:=IF(NP>FP,FP+AD/NOD*BSP,FP-AD/NOD*BSP);AT1:=IF(BETWEEN(CURRBARSCOUNT,BC2,TC2) AND H>LRL,H,LRL);AT2:=HHV(AT1-LRL,MAX(BC2,TC2));AT3:=CONST(BARSLAST(AT1-LRL=AT2));AT4:=CONST(IF(AT3=0,H,REF(H,AT3)));AT5:=CONST(IF(AT3=0,AT1-LRL,REF(AT1-LRL,AT3)));ATL:=LRL+AT5;UT1:=IF(BETWEEN(CURRBARSCOUNT,BC2,TC2) AND L<LRL,L,LRL);UT2:=HHV(LRL-UT1,MAX(BC2,TC2));UT3:=CONST(BARSLAST(LRL-UT1=UT2));UT4:=CONST(IF(UT3=0,H,REF(H,UT3)));UT5:=CONST(IF(UT3=0,LRL-UT1,REF(LRL-UT1,UT3)));UTL:=LRL-UT5;RH:=IF(CURRBARSCOUNT>=MIN(BC2,TC2)-10,ATL,CONST(REF(ATL,MIN(BC 2,TC2)-11)));{限制高}RL:=IF(CURRBARSCOUNT>=MIN(BC2,TC2)-10,UTL,CONST(REF(UTL,MIN(BC 2,TC2)-11)));{限制低}中轨:IF(NP>FP,IF(LRL<=RH,LRL,DRAWNULL),IF(LRL>=RL,LRL,DRAWNULL)),C OLOR628962;上轨:IF(NP>FP,IF(ATL<=RH,ATL,DRAWNULL),IF(ATL>=RL,ATL,DRAWNULL)),C OLOR628962;下轨:IF(NP>FP,IF(UTL<=RH,UTL,DRAWNULL),IF(UTL>=RL,UTL,DRAWNULL)),C OLOR628962;{极品波浪指标,有此公式必发达}A1:=REF(HIGH,3)=HHV(HIGH,2*3+1);B1:=FILTER(A1,3);C1:=BACKSET(B1,3+1);D1:=FILTER(C1,3);{高点}A2:=REF(LOW,3)=LLV(LOW,2*3+1);B2:=FILTER(A2,3);C2:=BACKSET(B2,3+1);D2:=FILTER(C2,3);{低点}E1:=(REF(LLV(LOW,2*3),1)+REF(HHV(HIGH,2*3),1))/2;E2:=(HIGH+LOW)/2;{高低点出现在同一K线上时可作取舍}H1:=(D1 AND NOT((D2 AND E1>=E2))) OR ISLASTBAR OR BARSCOUNT(CLOSE)=1;L1:=(D2 AND NOT((D1 AND E1<E2)));H2:=D1 AND NOT((D2 AND E1>=E2));X1:=REF(BARSLAST(H1),1)+1;F1:=BACKSET(H1 AND COUNT(L1,X1)>0,LLVBARS(IF(L1,LOW,10000),X1)); G1:=F1>REF(F1,1);I1:=BACKSET(G1,2);LD:=I1>REF(I1,1);{过滤后低点}L2:=LD OR ISLASTBAR OR BARSCOUNT(CLOSE)=1;X2:=REF(BARSLAST(L2),1)+1;F2:=BACKSET(L2 AND COUNT(H2,X2)>0,HHVBARS(IF(H2,HIGH,0),X2));G2:=F2>REF(F2,1);I2:=BACKSET(G2,2);HD:=I2>REF(I2,1);{过滤后高点}DRAWLINE(LD,L,HD,H,0),COLORMAGENTA,LINETHICK1;DRAWLINE(HD,H,LD,L,0),COLORMAGENTA,LINETHICK1;J1:=BACKSET(ISLASTBAR ,MIN(BARSLAST(HD),BARSLAST(LD))+1);J2:=J1>REF(J1,1);DRAWLINE(J2,IF(HD,H,L),ISLASTBAR ,IF(BARSLAST(HD)>BARSLAST(LD),H,L ),0),COLORWHITE,LINETHICK1;{}市盈率:IF(FINANCE(33)>0,DYNAINFO(39),0)*0.35,NODRAW;每股收益:IF(FINANCE(33)>0.01,FINANCE(33)*0.65,0),NODRAW;CKMJ:=每股收益*市盈率*4;。
通达信指标公式源码超级精准布林线
公式源码:S:=2;P:=0;VARA:=(((CLOSE - EMA(CLOSE,13)) / EMA(CLOSE,13)) * (0 - 100));趋势线:=EMA(((VARA/10)+EMA(CLOSE,10)),3);VARB:=(OPEN+HIGH+LOW)/3;VARC:=EMA(VARB,4);行情线:=VARC;BUY11:=IF(CROSS(行情线,趋势线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线>趋势线),1,0);DRAWTEXT(CROSS(行情线,趋势线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线>趋势线),LOW*0.98,'▲'),COLOR0000FF;趋势线),LOW*0.97,'∣'),COLOR0000FF;DRAWTEXT(CROSS(行情线,趋势线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线>趋势线),LOW*0.975,'‖'),COLOR0000FF;DRAWTEXT(CROSS(行情线,趋势线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线>趋势线),LOW*0.96,'∣'),COLOR0000FF;DRAWTEXT(CROSS(行情线,趋势线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线>趋势线),LOW*0.97,'‖'),COLOR0000FF;DRAWTEXT(CROSS(行情线,趋势线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线>趋势线),LOW*0.95,'∣'),COLOR0000FF;DRAWTEXT(CROSS(行情线,趋势线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线>趋势线),LOW*0.965,'‖'),COLOR0000FF;DRAWTEXT(CROSS(趋势线,行情线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线<趋势线),HIGH*1.02,'▼'),COLOR00FF00;DRAWTEXT(CROSS(趋势线,行情线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线<趋势线),HIGH*1.030,'∣'),COLOR00FF00;DRAWTEXT(CROSS(趋势线,行情线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线<趋势线),HIGH*1.025,'‖'),COLOR00FF00;DRAWTEXT(CROSS(趋势线,行情线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线<趋势线),HIGH*1.040,'∣'),COLOR00FF00;DRAWTEXT(CROSS(趋势线,行情线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线<趋势线),HIGH*1.03,'‖'),COLOR00FF00;趋势线),HIGH*1.050,'∣'),COLOR00FF00;DRAWTEXT(CROSS(趋势线,行情线) OR (REF(行情线,1)=REF(趋势线,1) AND 行情线<趋势线),HIGH*1.035,'‖'),COLOR00FF00;FF:=EMA(CLOSE,3);MA15:=EMA(CLOSE,21);FA:=IF(CROSS(FF,MA15),1,0);TR1:=MAX(MAX((HIGH - LOW),ABS(REF(CLOSE,1) - HIGH)),ABS(REF(CLOSE,1) - LOW));ATR:=MA(TR1,14);AA:=(HHV(HIGH,20) - (2 * ATR));BB:=CROSS(CLOSE,REF(HHV(HIGH,55),1));SSS:=CROSS(MIN(MA(CLOSE,13),AA),CLOSE);BBB:=BARSLAST(BB);SSSB:=BARSLAST(SSS);B1:=((BBB = 0) AND (REF(SSSB,1) < REF(BBB,1)));B1B:=BARSLAST(B1);B2:=((((BB = 1) AND (B1B < SSSB)) AND (B1B > 0)) AND (COUNT(BB,SSSB) < 3));B2B:=BARSLAST(B2);B3:=((((BB = 1) AND (B2B < B1B)) AND (COUNT(BB,SSSB) < 4)) AND(COUNT(BB,SSSB) > 2));DRAWTEXT((B1=1 AND 行情线>=趋势线AND BUY11=0) OR (B2=1 AND 行情线>=趋势线AND BUY11=0),LOW*0.98,'▲'),COLORFF00FF;A:=(3*CLOSE+LOW+OPEN+HIGH)/6;X:=(20*A+19*REF(A,1)+18*REF(A,2)+17*REF(A,3)+16*REF(A,4)+15*REF(A,5)+14*REF(A,6)+13*REF(A,7)+12*REF(A,8)+11*REF(A,9)+10*REF(A,10)+9*REF(A,11)+8* REF(A,12)+7*REF(A,13)+6*REF(A,14)+5*REF(A,15)+4*REF(A,16)+3*REF(A,17)+2*REF(A,18)+REF(A,20))/210;Y:=EMA(X,13);加仓A:=SMA(EMA((C-REF(C,1))/REF(C,1),5)*100,3,1)*10;DRAWTEXT(FILTER((CROSS(加仓A,0) OR CROSS(CLOSE,Y)) AND 行情线>=趋势线AND BUY11=0 AND FA=0,3),LOW*0.98,'▲'),COLORFF00FF;加仓:=(B1=1 AND 行情线>=趋势线AND BUY11=0) OR (B2=1 AND 行情线>=趋势线AND BUY11=0) OR FILTER((CROSS(加仓A,0) OR CROSS(CLOSE,Y)) AND 行情线>=趋势线AND BUY11=0 AND FA=0,3);STICKLINE(加仓,C,O,6,1),COLORFF00FF;STICKLINE(加仓,OPEN,CLOSE,4.5,1),COLORFF0099;STICKLINE(加仓,OPEN,CLOSE,3,0),COLORFF00CC;STICKLINE(加仓,OPEN,CLOSE,2,0),COLORFF00FF;VARJ1:=REF(CLOSE,1);VARJ2:=((SMA(MAX(CLOSE-VARJ1,0),6,1))/(SMA(ABS(CLOSE-VARJ1),6,1)))*(100);减仓A:=CROSS(85,VARJ2);DRAWTEXT(减仓A AND 行情线>=趋势线,HIGH*1.02,'▼'),COLORYELLOW;MTM:=C-REF(C,1);DX:=100*EMA(EMA(MTM,6),6)/EMA(EMA(ABS(MTM),6),6);DY:=HHV(DX,2)=HHV(DX,7) AND COUNT(DX>50,2) AND CROSS(MA(DX,2),DX); LC:=REF(CLOSE,1);RSI:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;减仓B:=FILTER(CROSS(84,RSI) OR DY,5);DRAWTEXT(减仓B AND 行情线>=趋势线,H*1.02,'▼'),COLORYELLOW;减仓:=减仓A OR 减仓B;DRAWTEXT(FA AND BUY11=0,(LOW * 0.98),'□□'),COLOR0099FF;底背离:=FA AND BUY11=0;{TY:=C;HD:=FILTER(BACKSET(FILTER(REF(TY,10)=HHV(TY,2*10+1),10),10+1),10);LD:=FILTER(BACKSET(FILTER(REF(TY,10)=LLV(TY,2*10+1),10),10+1),10);A2:=REF(C,BARSLAST(HD));B2A:=REF(C,BARSLAST(LD));T1:=BARSLAST(HD)<BARSLAST(LD) AND NOT(HD) ;T2:=BARSLAST(HD)>BARSLAST(LD) AND NOT(LD);顶:IF(T1,A2,A2),COLOR00FF00,POINTDOT,LINETHICK2;STICKLINE(T1,A2,A2,9,0),COLOR00FF00;底:IF(T2,B2A,B2A),COLORFF00FF,POINTDOT,LINETHICK2;STICKLINE(T2,B2A,B2A,9,0),COLORFF00FF;}VAR2:=(C+L+O+H)/4;多头线:=(20*VAR2+19*REF(VAR2,1)+18*REF(VAR2,2)+17*REF(VAR2,3)+16*REF(VAR2,4) +15*REF(VAR2,5)+14*REF(VAR2,6)+13*REF(VAR2,7)+12*REF(VAR2,8)+11*REF(VAR 2,9)+10*REF(VAR2,10)+9*REF(VAR2,11)+8*REF(VAR2,12)+7*REF(VAR2,13)+6*REF( VAR2,14)+5*REF(VAR2,15)+4*REF(VAR2,16)+3*REF(VAR2,17)+2*REF(VAR2,18)+RE F(VAR2,19))/210;空头线:=EMA(多头线,4);STICKLINE(多头线>空头线,多头线,空头线,4,1),COLORYELLOW;STICKLINE(多头线<空头线,多头线,空头线,4,1),COLORCCCCCC;压制:DRAWLINE(C=HHV(C,60),HHV(H,3),C=HHV(C,30) ANDC<HHV(C,45),HHV(HIGH,1),P),COLORYELLOW;依托:DRAWLINE(L=LLV(L,60),LLV(L,3),L=LLV(L,30) ANDL>LLV(L,45),LLV(L,3),P),COLORGREEN;E:=(REF(H,S-1)+REF(L,S-1)+REF(C,S-1))/3;CRTP:=2*E+(REF(H,S-1)-2*REF(L,S-1));CRZL:=2*E-REF(L,S-1);CRZC:=2*E-REF(H,S-1);CRFZ:=2*E-(2*REF(H,S-1)-REF(L,S-1));高:=CONST(CRTP),COLORRED;阻:=CONST(CRZL),COLORC7C9FF;平:=CONST(E),COLORBLUE;支:=CONST(CRZC),COLOR7C9CFF;反:=CONST(CRFZ),COLORDD00DD;AH:DRAWLINE(S>1&&CURRBARSCOUNT=S+1,高,ISLASTBAR,高,1),COLORRED; STICKLINE(ISLASTBAR AND C>(高+阻)*0.5,高,高,22,0),COLORRED;NH:DRAWLINE(S>1&&CURRBARSCOUNT=S,阻,ISLASTBAR,阻,1),COLORC7C9FF; STICKLINE(ISLASTBAR AND C>(支+平)*0.5,阻,阻,18,0),COLORC7C9FF;CDP:DRAWLINE(S>1&&CURRBARSCOUNT=S+3,平,ISLASTBAR,平,1),COLORBLUE; STICKLINE(ISLASTBAR,平,平,27,0),COLORBLUE;NL:DRAWLINE(S>1 &&CURRBARSCOUNT=S,支,ISLASTBAR,支,1),COLOR7C9CFF; STICKLINE(ISLASTBAR AND C<(阻+平)*0.5 ,支,支,18,0),COLOR7C9CFF;AL:DRAWLINE(S>1&&CURRBARSCOUNT=S+1,反,ISLASTBAR,反,1),COLORDD00DD; STICKLINE(ISLASTBAR AND C<(反+支)*0.5,反,反,22,0),COLORDD00DD;TBP:2*REF(C,S)-REF(C,(S+2)),COLORYELLOW,NODRAW;TXR:=MAX(MAX((REF(H,S-1)-REF(L,S-1)),ABS(REF(C,S-1)-REF(H,S))),ABS(REF(C,S-1) - REF(L,S))),NODRAW;TPS:=CONST(E-TXR),NODRAW;TMB:=CONST(E+TXR),NODRAW;PS:DRAWLINE(S>1&&CURRBARSCOUNT=S+2,TPS,ISLASTBAR,TPS,S),COLORLICY AN;STICKLINE(ISLASTBAR AND C<平,TPS,TPS,25,0),COLORLICYAN;MB:DRAWLINE(S>1&&CURRBARSCOUNT=S+2,TMB,ISLASTBAR,TMB,S),COLORLIG RAY;STICKLINE(ISLASTBAR AND C>平,TMB,TMB,25,0),COLORLIGRAY;RMB:=CONST(BBI),NODRAW;RR:DRAWLINE(S>1&&CURRBARSCOUNT=2+2,RMB,ISLASTBAR,RMB,1),COLORLIR ED,CIRCLEDOT;强D:=HHV(((HIGH + REF(C,1)+REF(LOW,1))/3),17),COLORRED,{NODRAW};强K:=HHV(((HIGH+C+REF(LOW,1))/3),17),COLORYELLOW,POINTDOT{MAX(强DNODRAW};QD50:=((强D+强K)*0.5+MAX(强D,强K))*0.5;DRAWBAND(强D,RGB(0,153,0),QD50,RGB(255,0,0));弱D:=LLV(((REF(HIGH,1)+REF(C,1)+LOW)/3),17*(P+1)),COLORGREEN;弱K:=LLV(((HIGH+C+REF(LOW,1))/3),17*(P+1)),COLORYELLOW,POINTDOT;RD50:=((弱D+弱K)*0.5+MIN(弱D,弱K))*0.5;XO:=(强D+弱D)*0.5,COLORMAGENTA;DRAWBAND(弱D,RGB(255,255,53),RD50,RGB(0,102,255));。
自动趋势画线主图,趋势一目了然通达信指标公式源码
HIGHN:=10;LOWN:=10;HIGHDISPLAY:=0;LOWDISPLAY:=0;ZGDISPLAY:=0;MADISPLAY :=0;AAB:=REF(H,HIGHN)=HHV(H,2*HIGHN+1);QY:=BACKSET(AAB,HIGHN+1);CC:=FILTER(QY,HIGHN) AND H=HHV(H,HIGHN+1);DRAWICON(CC,H*1.02,2);DDD:=BARSLAST(CC);GDTS:=IF(CC,CURRBARSCOUNT,0);DINGBU:=IF(DDD,REF(H,DDD),H);DINGBUTS:=IF(DDD,REF(GDTS,DDD),GDTS);DINGBU1:=REF(DINGBU,DDD+1);GDCS1:=CONST(DINGBUTS);DINGBUTS1:=REF(DINGBUTS,DDD+1);GDCS2:=CONST(DINGBUTS1);DINGBU2:=REF(DINGBU1,DDD+1);MMM:=IF(CURRBARSCOUNT>GDCS2,0,1);高点压力:DRAWLINE(CURRBARSCOUNT=GDCS2,H,CURRBARSCOUNT=GDCS1,H,1) COLORGREEN,DOTLINE;压力A:DRAWLINE(CURRBARSCOUNT=GDCS2,H,ISLASTBAR,REF(H,GDCS2-1),1),COLOR0055F F,DOTLINE;压力B:DRAWLINE(CURRBARSCOUNT=GDCS1,H,ISLASTBAR,REF(H,GDCS1-1),1),COLORYELLOW,DOTLINE;AA1:=REF(L,LOWN)=LLV(L,2*LOWN+1);QY1:=BACKSET(AA1,LOWN+1);CC1:=FILTER(QY1,LOWN) AND L=LLV(L,LOWN+1);DD1:=BARSLAST(CC1);DDTS:=IF(CC1,CURRBARSCOUNT,0);YDB:=IF(DD1,REF(L,DD1),L);DDTS1:=IF(DD1,REF(DDTS,DD1),DDTS);DDCS1:=CONST(DDTS1);ZDB:=REF(YDB,DD1+1);DDTS2:=REF(DDTS1,DD1+1);DDCS2:=CONST(DDTS2);低点支撑:DRAWLINE(CURRBARSCOUNT=DDCS2,L,CURRBARSCOUNT=DDCS1,L,1) COLORRED,DOTLINE;ZGSTAR:=(高点压力+低点支撑)/2;ZGEND:=CONST((高点压力+低点支撑)/2);STARDAY:=IF(DDCS2<GDCS2,DDCS2,GDCS2);中轨:DRAWLINE(CURRBARSCOUNT=STARDAY,ZGSTAR,ISLASTBAR,ZGEND,1),POINTDOT, COLORFFBBFF,LINETHICK1;TTT:=6;A1:=REF(HIGH,6)=HHV(HIGH,2*TTT+1); B1:=FILTER(A1,TTT);C1:=BACKSET(B1,TTT+1); D1:=FILTER(C1,TTT);A2:=REF(LOW,TTT)=LLV(LOW,2*TTT+1); B2:=FILTER(A2,TTT);C2:=BACKSET(B2,TTT+1); D2:=FILTER(C2,TTT);E1:=(REF(LLV(LOW,2*TTT),1)+REF(HHV(HIGH,2*TTT),1))/2; E2:=(HIGH+LOW)/2;H1:=(D1 AND NOT(D2 AND E1>=E2)) OR BARSTATUS OR BARSCOUNT(CLOSE)=1;L1:=(D2 AND NOT(D1 AND E1<E2)); H2:=D1 AND NOT(D2 AND E1>=E2);X1:=REF(BARSLAST(H1),1)+1; F1:=BACKSET(H1 ANDCOUNT(L1,X1)>0,LLVBARS(IF(L1,LOW,10000),X1));G1:=F1>REF(F1,1); I1:=BACKSET(G1,2); LD:=I1>REF(I1,1);L2:=LD OR BARSTATUS OR BARSCOUNT(CLOSE)=1;X2:=REF(BARSLAST(L2),1)+1; F2:=BACKSET(L2 ANDCOUNT(H2,X2)>0,HHVBARS(IF(H2,HIGH,0),X2));G2:=F2>REF(F2,1); I2:=BACKSET(G2,2); HD:=I2>REF(I2,1);UU:=BACKSET(BARSTATUS,BARSLAST(LD)+1);VV:=UU>REF(UU,1);WW:=BACKSET(VV,REF(BARSLAST(LD),1)+2);XX:=WW>REF(WW,1);UU2:=BACKSET(BARSTATUS,BARSLAST(HD)+1);VV2:=UU2>REF(UU2,1);WW2:=BACKSET(VV2,REF(BARSLAST(HD),1)+2);XX2:=WW2>REF(WW2,1);近低A:REF(L,BARSLAST(VV)),COLORWHITE,LINETHICK1,DOTLINE;近低B:REF(L,BARSLAST(XX)),COLORMAGENTA,DOTLINE;DRAWTEXT(CURRBARSCOUNT=2,高点压力,STRCAT('压力延伸:',CON2STR(高点压力,2))),COLORYELLOW;DRAWTEXT(CURRBARSCOUNT=2,低点支撑,STRCAT('支撑延伸:',CON2STR(低点支撑,2))),COLORYELLOW;DRAWTEXT(CURRBARSCOUNT=2,中轨,STRCAT('中轨:',CON2STR(中轨,2))),COLORYELLOW;DRAWTEXT(CURRBARSCOUNT=2,压力A,STRCAT('压力A:',CON2STR(压力A,2))),COLORYELLOW;DRAWTEXT(CURRBARSCOUNT=2,压力B,STRCAT('压力B:',CON2STR(压力B,2))),COLORYELLOW;DRAWTEXT(CURRBARSCOUNT=2,近低A,STRCAT('←近低A:',CON2STR(近低A,2))),COLORWHITE;DRAWTEXT(CURRBARSCOUNT=2,近低B,STRCAT('←近低B:',CON2STR(近低B,2))),COLORMAGENTA;。
MACD背离自动画线通达信指标公式源码
MACD背离自动画线通达信指标公式源码通达信(MetaStock)是一种常用的股票分析软件,提供了丰富的指标库。
在通达信中编写指标公式可以使用通达信自带的公式语言-支持C语言语法。
为了实现MACD背离自动画线指标,我们首先要计算MACD指标的数值,并判断是否出现背离。
接下来,我们可以使用通达信的画线函数实现在背离点位置上自动画线。
下面是该指标的示例源码:```javascript/*时间:2024-01-01*/#include "stdio.h"#include "stdlib.h"#include "string.h"#include "windows.h"/*定义MACD指标相应变量*/double EMA_SHORT;double EMA_LONG;double DIFF;double DEA;double MACD;/*初始化操作,在指标开始计算之前调用*/void InitEMA_SHORT=0;EMA_LONG=0;DIFF=0;DEA=0;MACD=0;/*计算MACD指标的数值*/void CalculateMACD(double close[], int n, int shortPeriod, int longPeriod, int signalPeriod)double EMA_SHORT_SMOOTH = 2.0 / (shortPeriod + 1);double EMA_LONG_SMOOTH = 2.0 / (longPeriod + 1);//计算短期EMAdouble emaShortPrev = close[0];for (int i = 0; i < shortPeriod; i++)emaShortPrev = emaShortPrev * (1 - EMA_SHORT_SMOOTH) +close[i] * EMA_SHORT_SMOOTH;}//计算长期EMAdouble emaLongPrev = close[0];for (int i = 0; i < longPeriod; i++)emaLongPrev = emaLongPrev * (1 - EMA_LONG_SMOOTH) + close[i] * EMA_LONG_SMOOTH;}//计算DIFF和DEADIFF = emaShortPrev - emaLongPrev;DEA=0;double DEA_SMOOTH = 2.0 / (signalPeriod + 1);for (int i = 0; i < signalPeriod; i++)DEA=DEA*(1-DEA_SMOOTH)+DIFF*DEA_SMOOTH;}//计算MACDMACD=(DIFF-DEA)*2;/*判断是否出现背离*/int IsDivergence(double close[], int n, int direction)for (int i = 2; i < n; i++)double prevClose1 = close[i - 2];double prevClose2 = close[i - 1];double currentClose = close[i];if (direction == 1) // 上涨背离:前两个低点价格下降,当前高点价格上升if (prevClose1 > prevClose2 && prevClose2 > currentClose) return i;}}else if (direction == -1) // 下跌背离:前两个高点价格上升,当前低点价格下降if (prevClose1 < prevClose2 && prevClose2 < currentClose)return i;}}}return -1;/*自动画线函数,在背离位置上自动画线*/void AutoDrawLine(int barIndex, int direction)//自动画线的相关处理,这里仅做示例printf("在第 %d 根K线上画上涨背离线。
通达信指标公式源码自动画线主图指标公式
通达信自动画线主图指标公式自动化线的顶底两条线有未来,其他没有未来JRH:=HHV(C,2);JRL:=LLV(C,2);MA3:=MA(CLOSE,3);YTSL:=(3*CLOSE+LOW+OPEN+HIGH)/6;R1:=(CLOSE>REF(CLOSE,1) AND CLOSE>REF(CLOSE,2));R2:=(REF(R1,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2)); R3:=(REF(R2,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2)); R4:=(REF(R3,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2)); R5:=(REF(R4,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2)); R6:=(REF(R5,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2)); R7:=(REF(R6,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2)); R8:=(REF(R7,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2)); R9:=(REF(R8,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2)); RA:=(REF(R9,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2)); RB:=(REF(RA,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2)); RC:=(REF(RB,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2)); RD:=(CLOSE<REF(CLOSE,1) AND CLOSE<REF(CLOSE,2));RE:=(REF(RD,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2)); RF:=(REF(RE,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2)); R10:=(REF(RF,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2)); R11:=(REF(R10,1) AND CLOSE<=REF(CLOSE,1) ANDCLOSE>=REF(CLOSE,2));R12:=(REF(R11,1) AND CLOSE>=REF(CLOSE,1) ANDCLOSE<=REF(CLOSE,2));R13:=(REF(R12,1) AND CLOSE<=REF(CLOSE,1) ANDCLOSE>=REF(CLOSE,2));R14:=(REF(R13,1) AND CLOSE>=REF(CLOSE,1) ANDCLOSE<=REF(CLOSE,2));R15:=(REF(R14,1) AND CLOSE<=REF(CLOSE,1) ANDCLOSE>=REF(CLOSE,2));R16:=(REF(R15,1) AND CLOSE>=REF(CLOSE,1) ANDCLOSE<=REF(CLOSE,2));R17:=(REF(R16,1) AND CLOSE<=REF(CLOSE,1) ANDCLOSE>=REF(CLOSE,2));R18:=(REF(R17,1) AND CLOSE>=REF(CLOSE,1) ANDCLOSE<=REF(CLOSE,2));R19:=REF(RD OR RE OR RF OR R10 OR R11 OR R12 OR R13 OR R14 OR R15 OR R16 OR R17 OR R18,1) AND R1;R1A:=((REF(R1 OR R2 OR R3 OR R4 OR R5 OR R6 OR R7 OR R8 OR R9 OR RA OR RB OR RC,1)) AND RD);VAR3:=IF(C<200 ,MA(COST(80),3),2500),NODRAW;VAR4:=(((HIGH + LOW) + CLOSE) / 3);VAR5:=EMA(((((OPEN + HIGH) + LOW) + CLOSE) / 4),2330);VAR6:=(VAR5 + ((VAR5 * 6) / 100));春买:=R19,NODRAW,COLOR00DD00;秋离场:=R1A,NODRAW,COLOR2288EE;红持股:=R1 OR R2 OR R3 OR R4 OR R5 OR R6 OR R7 OR R8 OR R9 OR RA OR RB OR RC,NODRAW,COLOR0000FF;阴观望:=RD OR RE OR RF OR R10 OR R11 OR R12 OR R13 OR R14 OR R15 OR R16 OR R17 OR R18,NODRAW,COLOR999999;急速超跌关注:=(CLOSE-MA(CLOSE,34))/MA(CLOSE,34)*100<-14,COLORBBBBBB,NODRA W;离场:=IF(红持股,JRL,DRAWNULL);明离场价:=离场,COLORFF99FF,NODRAW;今离场价:=REF(离场,1)COLOR0000FF,NODRAW;进:=IF(阴观望,JRH,DRAWNULL);明进场价:=进,COLOR33AACC,NODRAW;今进场价:=REF(明进场价,1),COLOR00FF00,NODRAW;STICKLINE(ISLASTBAR AND (红持股OR REF(红持股,1)=1),今离场价,今离场价,20,1),COLOR0000FF;STICKLINE(ISLASTBAR AND (阴观望OR REF(阴观望,1)=1),今进场价,今进场价,20,1),COLOR00FF00;XX2:EMA(EMA((CLOSE+LOW+HIGH)/3,3),23),COLORGREEN, LINETHICK2; XX3:=REF(XX2,1);IF(XX2>XX3,XX2,DRAWNULL),COLORRED, LINETHICK2;B11:=MA(CLOSE,1);B22:=SMA(SMA(SMA(B11,2,1),2,1),2,1) ;SMA2:=MA(B22,3) ;DRAWBAND(B22,RGB(255,0,0),SMA2,RGB(0,255,0));下档线:=(((CLOSE - LLV(LOW,13)) / (HHV(HIGH,13) - LLV(LOW,13))) * 100); 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))) * 100); 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;压力位:=IF(ISLASTBAR,压力2,DRAWNULL),NODRAW;底部位:=IF(ISLASTBAR,底部,DRAWNULL),NODRAW;STICKLINE(ISLASTBAR ,压力位,压力位,40,0),COLORFF00FF,LINETHICK2; STICKLINE(ISLASTBAR ,底部位,底部位,35,0),COLOR00FFFF,LINETHICK2;B1:=REF(CLOSE,1);B2:=REF(CLOSE,2);B3:=REF(CLOSE,3);B4:=REF(CLOSE,4);CMAX:=MAX(MAX(MAX(CLOSE,B1),B2),B3);CMIN:=MIN(MIN(MIN(CLOSE,B1),B2),B3);持股:=(CLOSE=CMAX AND (B1>=B2 OR B1>=B3)) OR ((B1=CMAX AND(B2=CMIN OR B3=CMIN)) AND CLOSE>=B2) OR(B2=CMAX AND B3=CMIN AND CLOSE>=B1) OR (B3=CMAX AND CLOSE>=B1 AND CLOSE>=B2);STICKLINE(持股,B1,CLOSE,3,0),COLOR000099;变盘:=CLOSE=CMAX AND B1=CMIN;STICKLINE(变盘,B2,CLOSE,3,0),COLOR0099EF;下跌:=(CLOSE=CMIN AND (B1<B2 OR B1<B3)) OR ((B1=CMIN AND(B2=CMAX OR B3=CMAX)) AND CLOSE<B2) OR(B2=CMIN AND B3=CMAX AND CLOSE<B1) OR (B3=CMIN AND CLOSE<B1 AND CLOSE<B2);STICKLINE(下跌,B1,CLOSE,3,0),COLOR009900;STICKLINE(B1=CMAX AND CLOSE=CMIN,B2,CLOSE,3,0),COLOR009900;买入:=(B1=CMIN AND CLOSE>=B2) OR ((B2=CMIN AND B1<=B3) OR(B3=CMIN AND B1<=B2) AND B2<B4 AND CLOSE>=B1);STICKLINE(买入,B1,B2,3,0),COLOR00FFFF;抛售:=(B1=CMAX AND CLOSE<B2) OR ((B2=CMAX AND B1>B3) OR(B3=CMAX AND B1>B2) AND B2>=B4 AND CLOSE<B1);STICKLINE(抛售,B1,B2,3,0),COLORFFFFFF;STICKLINE(C>=O,L,H,0,1),COLORRED;STICKLINE(C<O,H,L,0,1),COLORGREEN;STICKLINE(持股OR 买入,O,C,1.5,0),COLORRED;STICKLINE(下跌OR 抛售,O,C,1.5,0),COLORGREEN;STICKLINE(C>0,O,C,0,0),COLORFFFFFF;MMA:=CONST(HHV(H,90));MMB:=CONST(LLV(L,90));WN:=3;{原码N:=3;}WA1:=REF(H,WN)=HHV(H,2*WN+1); WB1:=FILTER(WA1,WN);WC1:=BACKSET(WB1,WN+1); WD1:=FILTER(WC1,WN);{高点}WA2:=REF(L,WN)=LLV(L,2*WN+1); WB2:=FILTER(WA2,WN);WC2:=BACKSET(WB2,WN+1); WD2:=FILTER(WC2,WN);{低点}WE1:=(REF(LLV(L,2*WN),1)+REF(HHV(H,2*WN),1))/2;WE2:=(H+L)/2;{高低点出现在同一K线上时可作取舍}WH1:=(WD1 AND NOT(WD2 AND WE1>=WE2)) OR ISLASTBAR OR BARSCOUNT(C)=1;WL1:=(WD2 AND NOT(WD1 AND WE1<WE2)); WH2:=WD1 AND NOT(WD2AND WE1>=WE2);WX1:=REF(BARSLAST(WH1),1)+1; WF1:=BACKSET(WH1 ANDCOUNT(WL1,WX1)>0,LLVBARS(IF(WL1,L,10000),WX1));WG1:=WF1>REF(WF1,1); WI1:=BACKSET(WG1,2);WLD:=WI1>REF(WI1,1);{过滤后低点}WL2:=WLD OR ISLASTBAR OR BARSCOUNT(C)=1;WX2:=REF(BARSLAST(WL2),1)+1; WF2:=BACKSET(WL2 ANDCOUNT(WH2,WX2)>0,HHVBARS(IF(WH2,H,0),WX2));WG2:=WF2>REF(WF2,1); WI2:=BACKSET(WG2,2);WHD:=WI2>REF(WI2,1);{过滤后高点}WR1:=BACKSET(ISLASTBAR,BARSLAST(WHD)+1); WS1:=WR1>REF(WR1,1); {前一高}WT1:=BACKSET(ISLASTBAR,BARSLAST(WLD)+1); WU1:=WT1>REF(WT1,1); {前一低}WR2:=BACKSET(WS1,REF(BARSLAST(WHD),1)+2); WS2:=WR2>REF(WR2,1); {前二高}WT2:=BACKSET(WU1,REF(BARSLAST(WLD),1)+2); WU2:=WT2>REF(WT2,1); {前二低}WT3:=BACKSET(WU2,REF(BARSLAST(WLD),1)+2); WU3:=WT3>REF(WT3,1); {前三低}WT4:=BACKSET(WU3,REF(BARSLAST(WLD),1)+2); WU4:=WT4>REF(WT4,1); {前四低}WR3:=BACKSET(WS2,REF(BARSLAST(WHD),1)+2); WS3:=WR3>REF(WR3,1); {前三高}WR4:=BACKSET(WS3,REF(BARSLAST(WHD),1)+2); WS4:=WR4>REF(WR4,1); {前四高};压力1:=DRAWLINE(WS2,H,WS1,H,1),COLOR008888; {★压力1:}支撑1:=DRAWLINE(WU2,L,WU1,L,1),COLOR008888;{★支撑1:}压力2:=DRAWLINE(WS3,H,WS2,H,1),COLOR888000; {★压力2:}支撑2:=DRAWLINE(WU3,L,WU2,L,1),COLOR888000;{★支撑2:}压力3:=DRAWLINE(WS4,H,WS3,H,1),COLOR0000CC;{★压力3:}支撑3:=DRAWLINE(WU4,L,WU3,L,1),COLOR0000CC;{★支撑3:};BSC:=CONST(MAX(BARSLAST(WS4),BARSLAST(WU4))*3),NODRAW;IF(BETWEEN(压力1,MMA,MMB),压力1,DRAWNULL),COLOR008888,LINETHICK1;IF(BETWEEN(支撑1,MMA,MMB),支撑1,DRAWNULL),COLOR008888,LINETHICK1;IF(BETWEEN(压力2,MMA,MMB),压力2,DRAWNULL),COLOR888000,LINETHICK1;IF(BETWEEN(支撑2,MMA,MMB),支撑2,DRAWNULL),COLOR888000,LINETHICK1;IF(BETWEEN(压力3,MMA,MMB),压力3,DRAWNULL),COLOR0000CC,LINETHICK1;IF(BETWEEN(支撑3,MMA,MMB),支撑3,DRAWNULL),COLOR0000CC,LINETHICK1;底:=SUM(MA(CLOSE,10),9)/11.114;DRAWTEXT(CROSS(LOW,底) AND REF(底,1)>REF(HIGH,1) OR CROSS(HIGH,底),L,'---铁底'),COLOR00FF00;X1:=(3*CLOSE+HIGH+LOW+OPEN)/6;X2:=EMA(X1,10);X3:=REF(X2,1);X4:=(REF(HIGH,1)+REF(LOW,1))/2;X5:=MA(CLOSE,21)+2*STD(CLOSE,21);X6:=REF(CLOSE,1);X7:=(SMA(MAX(CLOSE-X6,0),7,1))/(SMA(ABS(CLOSE-X6),7,1))*100;X8:=CROSS(79,X7);X9:=FILTER(X8,4);WZ1:=POW(MA(CLOSE,5),2)+MA(CLOSE,5);WZ2:=POW(MA(LOW,5),2)+MA(LOW,5);WZ3:=POW(MA(HIGH,5),2)+MA(HIGH,5);WZ4:=(WZ1-LLV(WZ2,9))/(HHV(WZ3,9)-LLV(WZ2,9))*150+65;DK:=SMA(WZ4,3,1)*1.5;DD:=SMA(DK,3,1);DJ:=3*DK-2*DD;WZ5:=EMA(CLOSE,12)-EMA(CLOSE,26);WZ6:=EMA(WZ5,9);WZ7:=2*(WZ5-WZ6);WZ8:=REF(WZ7,1);WZ9:=CROSS(WZ8,WZ7) AND WZ8>0;VAR1T:=EMA(CLOSE,8);VAR2T:=EMA(VAR1T,20);VAR3T:=CROSS(VAR1T,VAR2T);VAR4T:=VAR1T<MA(CLOSE,120);VAR5T:=(HHV(HIGH,36)-CLOSE)/(HHV(HIGH,36)-LLV(LOW,36))*100;VAR6T:=SMA(VAR5T,5,1);VAR7T:=SMA(VAR6T,8,1);VAR8T:=CROSS(VAR6T,VAR7T) AND VAR7T<20;VAR9T:=CLOSE>LLV(CLOSE,60)+0.3*LLV(CLOSE,60) AND VAR8T; VARA:=IF(CLOSE>1000,VAR8T,VAR9T);起步:=VAR3T AND VAR4T;逃遁:=VARA;XL1:=EMA(CLOSE,10)/100;XL2:=MA((XL1-REF(XL1,10))/REF(XL1,10),3)*100;XL3:=MA(XL2,3);XL4:=SMA((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,3,1); DRAWTEXT(IF(CROSS(3*XL4-2*SMA(XL4,3,1),8),87,0) AND X2>X3,LOW,'←反弹'),COLOR0000FF;DRAWTEXT(IF(CROSS((VAR1T-LLV(VAR1T,4))/(HHV(VAR1T,4)-LLV(VAR1T,4)) *4*25,87.5) AND VAR1T<40,87,0) AND X2>X3,LOW,'←短买'),COLOR0000AA; DRAWTEXT(IF(CROSS(2*(EMA((CLOSE*2+HIGH+LOW)/4,12)-EMA((CLOSE*2 +HIGH+LOW)/4,26)-(EMA(EMA((CLOSE*2+HIGH+LOW)/4,12)-EMA((CLOSE* 2+HIGH+LOW)/4,26),2)))*5.8,0.47),LOW,0) AND X2>X3,LOW,'←加仓'),COLORFF5ED8;DRAWTEXT(CROSS(X4,X5),HIGH+C*0.01,'←减'),COLORB4FF00; DRAWTEXT(FILTER((WZ9 AND DJ>250) OR X9 ,5),HIGH+C*0.02,'←跑'),COLORBCFF8B;STICKLINE(起步>0,HIGH,LOW,0.8,0),COLOR00FFFF;STICKLINE(起步>0,OPEN,CLOSE,5,0),COLOR00FFFF;DRAWTEXT(逃遁>0,HIGH,'●←逃'),COLOR7FFFD6;X1P:=(C+L+H)/3;BB13:=ATAN(EMA(X1P,13)-REF(EMA(X1P,13),1))*3.1416*10;EMA8:=EMA(C,8);DRAWTEXT(FILTER(BB13>1 ANDEMA(X1P,13)>REF(EMA(X1P,8),1),10),EMA8,'∠45上升'),COLORWHITE; VAR3AA:=IF((CLOSE>REF(CLOSE,1)),88,0);VAR4AA:=IF(((CLOSE)/(REF(CLOSE,1))>1.05) AND ((HIGH)/(CLOSE)<1.01) AND (VAR3AA>0),91,0);DRAWTEXT(FILTER((VAR4AA>90),45),(LOW),'★大胆搏'),COLOR00FFFF;L23:=MA(100*(CLOSE-LLV(CLOSE,34))/(HHV(HIGH,34)-LLV(LOW,34)),5)-20; L24:=(HIGH+LOW+CLOSE)/3;L25:=(L24-MA(L24,14))/(0.015*AVEDEV(L24,14));L26:=(L24-MA(L24,70))/(0.015*AVEDEV(L24,70));L27:=IF(L25>=150 AND L25<200 AND L26>=150 AND L26<200,10,0);L28:=IF(L25<=-150 AND L25>-200 AND L26<=-150 AND L26>-200,-10,L27); L29:=100-ABS((CLOSE-MA(CLOSE,13))/MA(CLOSE,13)*100);L30:=IF(L29<90,L29,100);L31:=IF(L23>0,L23,0);XL11:=(IF(L28>=200 AND L25>=150,15,IF(L26<=-200 ANDL25<=-150,-15,L28)))+60;XL22:=L31>48 AND XL11>60 AND L30<100;DRAWTEXT(XL22 AND COUNT(XL22,30)=1,L,'大笔买入'),COLORFF00FF; VAR3TD:=100-3*SMA((CLOSE-LLV(LOW,42))/(HHV(HIGH,42)-LLV(LOW,42))* 100,20,1)+2*SMA(SMA((CLOSE-LLV(LOW,42))/(HHV(HIGH,42)-LLV(LOW,42)) *100,20,1),15,1);VAR4TD:=100-3*SMA((OPEN-LLV(LOW,42))/(HHV(HIGH,42)-LLV(LOW,42))*1 00,20,1)+2*SMA(SMA((OPEN-LLV(LOW,42))/(HHV(HIGH,42)-LLV(LOW,42))*1 00,20,1),15,1);VAR2TD:=VAR3TD<REF(VAR4TD,1) AND VOL>REF(VOL,1) ANDCLOSE>REF(CLOSE,1);DRAWTEXT(VAR2TD AND COUNT(VAR2TD,30)=1,L,'大资金进场'),COLORFF00FF;DRAWTEXT_FIX(1,0,0,0,'市盈率:'),COLORYELLOW;DRAWNUMBER_FIX(1,0.08,0,0,CONST(DYNAINFO(39))),COLORYELLOW; DRAWTEXT_FIX(1,0.16,0,0,'每股收益(元):'),COLOR0080FF; DRAWNUMBER_FIX(1,0.29,0,0,CONST(FINANCE(33))),COLOR0080FF; DRAWTEXT_FIX(1,0.36,0,0,'莸利比例:'),COLORYELLOW; DRAWNUMBER_FIX(1,0.46,0,0,CONST(WINNER(C )*100)),COLORYELLOW; DRAWTEXT_FIX(1,0,0.05,0,'总股本(万股):'),COLORMAGENTA; DRAWNUMBER_FIX(1,0.13,0.05,0,CONST(FINANCE(1)/10000)),COLORMAGE NTA;DRAWTEXT_FIX(1,0,0.1,0,'所属板块:'),COLORYELLOW;DRAWTEXT_FIX(1,0.1,0.1,0,HYBLOCK),COLOR0080FF;DRAWTEXT_FIX(1,0.21,0.1,0,DYBLOCK),COLOR0080FF;{量能饱和}SAT:=IF((AMOUNT/C)/(HHV(AMOUNT,20)/HHV(C,20))*100>100,100,(AMOU NT/C)/(HHV(AMOUNT,20)/HHV(C,20))*100);DRAWTEXT_FIX(1,0.35,0.9,0,'量能饱和度:')COLOR00FFFF; DRAWNUMBER_FIX(1,0.48,0.9,0,CONST(SAT)),COLORYELLOW;。
通达信指标公式源码RSI自动画线
RSI自动画线有飞狐版的,大智慧版的唯独没有通达信版。
今改写成通达信版。
RSI:SMA(MAX(C-REF(C,1),0),8,1)/SMA(ABS(C-REF(C,1)),8,1)*100,COLORWHITE; A1:=REF(RSI,2)=HHV(RSI,2*2+1);B1:=FILTER(A1,2);C1:=BACKSET(B1,2+1);D1:=FILTER(C1,2);{高}A2:=REF(RSI,2)=LLV(RSI,2*2+1);B2:=FILTER(A2,2);C2:=BACKSET(B2,2+1);D2:=FILTER(C2,2);{低}H1:=(D1 AND NOT(D2)) OR BARSTATUS=2 OR BARSCOUNT(C)=1;L1:=(D2 AND NOT(D1));H2:=D1 AND NOT(D2);X1:=REF(BARSLAST(H1),1)+1;F1:=BACKSET(H1 AND COUNT(L1,X1)>0,LLVBARS(IF(L1,L,10000),X1));G1:=F1>REF(F1,1);I1:=BACKSET(G1,2);LD:=I1>REF(I1,1);{过滤后低点}L2:=LD OR BARSTATUS=2 OR BARSCOUNT(C)=1;X2:=REF(BARSLAST(L2),1)+1;F2:=BACKSET(L2 AND COUNT(H2,X2)>0,HHVBARS(IF(H2,H,0),X2));G2:=F2>REF(F2,1);I2:=BACKSET(G2,2);HD:=I2>REF(I2,1);{过滤后高点}R1:=BACKSET(BARSTATUS=2,BARSLAST(HD)+1);S1:=R1>REF(R1,1); {前一高}R2:=BACKSET(S1,REF(BARSLAST(HD),1)+2);S2:=R2>REF(R2,1); {前二高}R3:=BACKSET(S2,REF(BARSLAST(HD),1)+2);S3:=R3>REF(R3,1); {前三高}T1:=BACKSET(BARSTATUS=2,BARSLAST(LD)+1);U1:=T1>REF(T1,1); {前一低}T2:=BACKSET(U1,REF(BARSLAST(LD),1)+2);U2:=T2>REF(T2,1); {前二低}T3:=BACKSET(U2,REF(BARSLAST(LD),1)+2);U3:=T3>REF(T3,1); {前三低}{-----------------【图解模板】---------------------}压一:DRAWLINE(S2,RSI,S1,RSI,1),COLOR00B5B9,COLORRED; {压力1}压二:DRAWLINE(S3,RSI,S2,RSI,1),COLOR009AFF; {压力2}撑一:DRAWLINE(U2,RSI,U1,RSI,1),COLORFF68FF;{支撑1}撑二:DRAWLINE(U3,RSI,U2,RSI,1),COLORFFC800;{支撑2}DRAWLINE(U2,RSI,0,0,3),POINTDOT,COLORFFAFFF; {启动直线}20,COLORGRAY;50,COLORGRAY;80,COLORGRAY;IF(C,RSI,DRAWNULL),COLORWHITE;说明:任何公式都不是铁板一块,需要进行判断,有经验的根据自己的经验进行判断股价走势,没有经验的多看少动,待到有经验了再行判断不迟。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
将今天的开盘价收盘价最高价最低价和历史上的另一次价位相同连线。
实盘中能够快捷知道几天的开收高底四个价位上一次出现是哪一天?距离今天有多久?
我一般用开盘价分析,因为四个价位只有开盘价不漂移,同时也能更精准明白庄家为什么这个价位开盘?上一次什么时候也是这个价位开盘,后面的走势如何?等等信息,自己慢慢摸索。
免费源码,方便大家修改。
开盘价画线
N:=O;
J:=IF(ISLASTBAR,DRAWNULL,N);
上一次:BARSLAST(CONST(N)=J) NODRAW;
DRAWSL(ISLASTBAR,N,0,上一次,1),COLORYELLOW;
收盘价画线
N:=c;
J:=IF(ISLASTBAR,DRAWNULL,N);
上一次:BARSLAST(CONST(N)=J) NODRAW;
DRAWSL(ISLASTBAR,N,0,上一次,1),COLORYELLOW;
最低价画线
N:=l;
J:=IF(ISLASTBAR,DRAWNULL,N);
上一次:BARSLAST(CONST(N)=J) NODRAW;
DRAWSL(ISLASTBAR,N,0,上一次,1),COLORYELLOW;
最高价画线
N:=h;
J:=IF(ISLASTBAR,DRAWNULL,N);
上一次:BARSLAST(CONST(N)=J) NODRAW; DRAWSL(ISLASTBAR,N,0,上一次,1),COLORYELLOW;。