通达信指标公式源码概况:
指标类别: 通达信指标公式
授权方式: 免费版
指标评级: ★★★★★
指标分类: 策略
画线方法: 副图
一、k线变色指标公式源码
N:=20;
MID:=MA(C,N);
VART1:=POW((C-MID),2);
VART2:=MA(VART1,N);
VART3:=SQRT(VART2);
UPPER:=MID+2*VART3;
LOWER:=MID-2*VART3;
BOLL:REF(MID,1),COLORFFFFFF;
上升:IF(BOLL>REF(BOLL,1),BOLL,DRAWNULL),COLORRED,LINETHICK1;
下降:IF(BOLL<REF(BOLL,1),BOLL,DRAWNULL),COLORGREEN,LINETHICK1;
UB:REF(UPPER,1),COLOR00FFFF;
LB:REF(LOWER,1),COLORFF00FF;
K13:EXPMA(INDEXC,204),COLORWHITE;
K14:EXPMA(INDEXC,216),COLORWHITE;
K15:EXPMA(INDEXC,228),COLORWHITE;
K16:EXPMA(INDEXC,260),COLORWHITE;
K1:EXPMA(INDEXC,6),COLORRED;
K2:EXPMA(INDEXC,14),COLORRED;
K3:EXPMA(INDEXC,20),COLORRED;
K4:EXPMA(INDEXC,24),COLORLIGREEN;
K5:EXPMA(INDEXC,30),COLORYELLOW;
K6:EXPMA(INDEXC,36),COLORYELLOW;
K7:EXPMA(INDEXC,42),COLORYELLOW;
K8:EXPMA(INDEXC,48),COLORYELLOW;
K9:EXPMA(INDEXC,100),COLORBLUE;
K10:EXPMA(INDEXC,112),COLORBLUE;
K11:EXPMA(INDEXC,124),COLORBLUE;
K12:EXPMA(INDEXC,138),COLORBLUE;
RSV:=(INDEXC-LLV(INDEXL,9))/(HHV(INDEXH,9)-LLV(INDEXL,9))*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
J:=3*K-2*D;
STICKLINE(J>50,INDEXC,INDEXO,2,0),COLORFF0000;
STICKLINE(J>50,INDEXH,INDEXL,0,0),COLORFF0000;
STICKLINE(J<50,INDEXC,INDEXO,2,0),COLORFFFF00;
STICKLINE(J<50,INDEXH,INDEXL,0,0),COLORFFFF00;
STICKLINE(CROSS(50,J),INDEXC,INDEXO,2,0),COLORYELLOW;
STICKLINE(CROSS(50,J),INDEXH,INDEXL,0,0),COLORYELLOW;
STICKLINE(CROSS(J,50),INDEXC,INDEXO,2,0),COLORRED;
STICKLINE(CROSS(J,50),INDEXH,INDEXL,0,0),COLORRED;
T1:=MA(C,21)>REF(MA(C,21),1);
T2:=EXIST(C>REF(C,1)*1.093,21);
T3:=C<OANDC<REF(C,1)ANDEVERY(MA(C,5)<REF(MA(C,5),1),3);
T5:=EVERY(V<REF(V,1),2)ANDEVERY(V<MA(V,5),2);
T6:=MA(C,5)>MA(C,21);
XGG:=T1ANDT2ANDT3ANDT5ANDT6;
DRAWTEXT(XGG,L*0.99,'伏击'),COLOR00FF00;
AAAA:=MA(C,1);
AAA0:=SMA(SMA(SMA(AAAA,2,1),2,1),2,1);
BBB:=MA(AAA0,3);
DRAWBAND(AAA0,RGB(255,193,193),BBB,RGB(34,139,34));
MA05:MA(C,5)LINETHICK3,COLOR00CCFF;
MA10:=MA(C,10);
MA20:=MA(C,20);
MA30:=MA(C,30);
五日乖离率:=(C-MA05)/MA05*100;
BB05:=ATAN((MA05/REF(MA05,1)-1)*100)*180/3.1416;
速度5:=SMA(EMA((MA05-REF(MA05,1))/REF(MA05,1),3)*100,3,1);
加速度5:=EMA((速度5-REF(速度5,1)),3),NODRAW;
IF(BB05>30ANDMA05>REF(MA05,1),MA05,DRAWNULL),LINETHICK3,COLORRED;
BB10:=ATAN((MA10/REF(MA10,1)-1)*100)*180/3.1416;
IF(BB05<0ANDMA05<REF(MA05,1),MA05,DRAWNULL),LINETHICK3,COLORGREEN;
三拾日乖离率:=(C-MA30)/MA30*100,NODRAW;
VAR1:=(MA20-MA30)>REF((MA20-MA30),1)ANDMA20>REF(MA20,1)AND
MA30>REF(MA30,1);
VAR2:=(MA30-MA20)<REF((MA30-MA20),1)ANDMA20<REF(MA20,1)AND
MA30<REF(MA30,1);
BB30:=ATAN((MA30/REF(MA30,1)-1)*100)*180/3.1416;
强势狙击:=FILTER(BB30>30ANDBB10>45ANDCROSS(BB05,60),10);
加仓:=FILTER(COUNT(CROSS(BB05,30),5)>=1ANDMA05>REF(MA05,1)AND三拾日乖
离率>REF(三拾日乖离率,1)ANDMA10>REF(MA10,1)
AND加速度5>REF(加速度5,1)AND速度5>REF(速度5,1),10);
清仓:=FILTER(COUNT(CROSS(30,BB05),5)>=1AND(C>MA30ORO>MA30)AND
MA05<REF(MA05,1)AND三拾日乖离率<REF(三拾日乖离率,1)AND
MA10<REF(MA10,1),10);
DRAWTEXT(加仓,LOW*0.98,'←加仓'),COLORRED;
JC:=CROSS(0,五日乖离率)AND三拾日乖离率<REF(三拾日乖离率,1)AND
MA10>REF(MA10,1);
减仓:=FILTER(JC,10);
MR:=COUNT(CROSS(五日乖离率,0),3)>=1AND三拾日乖离率>REF(三拾日乖离率,1)
ANDMA05>REF(MA05,1)AND(C/REF(C,1)-1)*100>5ANDREF(C,1)<MA30;
买入:=FILTER(MR,10);
DRAWTEXT(减仓,HIGH*1.02,'←风险'),COLORCYAN;
DRAWTEXT(买入,LOW*0.98,'←买入'),COLORYELLOW;
{牛马线买点公式升级版}
{红底绿顶}
低:=REF(LLV(L,150),3);
近期底:=REFDATE(低,DATE);
最底:=REFDATE(近期底,DATE);
高:=REF(HHV(H,150),3);
近期顶:=REFDATE(高,DATE);
最顶:=REFDATE(近期顶,DATE),NODRAW;
出:=最顶=HAND((C-L)<(O-C)OR(O-L)<(C-O)),NODRAW;
STICKLINE(出,O,(C+O)/2,3,0),COLORBLUE;
STICKLINE(出,H,L,0.2,0),COLORBLUE;
DRAWTEXT(出,H*0.998,'–蓝顶'),COLORGREEN;
A2:=REF(MA(C,20),1);J1:=(MA(C,20)-A2)/A2*100;MJ1:=MA(J1,3);
乖离2:=(MA(C,20)-MA(C,30))/MA(C,30)*100;
VAC1:=IF(BETWEEN(乖离2,-2,5),2,0);
XL1:=((LLV(LOW,3)=LLV(LOW,60))AND((CLOSE/REF(CLOSE,1))>=1.04));
XL2:=(((CLOSE-EMA(CLOSE,21))/EMA(CLOSE,21))*100);
XL3:=CROSS(XL2,(0-20));
DRAWTEXT(FILTER(((XL1>0)ANDLOW),5),(LOW-0.0014),'●买点');
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);
DRAWTEXT(X9,(HIGH*0.9989),'-●出货'),COLORGREEN;
M10:=MA(C,10);
M13:=MA(C,13);
VVVV5:=CROSS(M10,M13);
WWF1:DRAWICON(VVVV5,H,11);
QQQQ1:STICKLINE(VVVV5<C,REF(C,BARSLAST(CROSS(M10,M13))),REF(C,BARSLAST(C
ROSS(M10,M13))),-1,-1),COLORWHITE;
RC1:=REF(C,1);
大阴线:=C<0.96*OORC<=RC1*0.96ORC>1000ANDC<=RC1*0.98;
大阴T:=BARSLAST(FILTER(大阴线,3));{调整显示密度}
大阴实顶:REF(O,大阴T),COLORLIGREEN,POINTDOT;{显示大阴K线的开盘价O};
MTM:=MA(C,6)-MA(C,13)+C;
MTMMA:MA(MTM,5),NODRAW;
AAA:=(3*C+H+L+O)/6;
VAR21:=(8*AAA+7*REF(AAA,1)+6*REF(AAA,2)+5*REF(AAA,3)+4*REF(AAA,4)+3*REF(A
AA,5)+2*REF(AAA,6)+REF(AAA,8))/36;
TJ1:=VOL=HHV(VOL,10)ANDVOL>2*REF(VOL,1)ANDCLOSE>VAR21;
立桩量:=FILTER(TJ1,5);
D1:REF(LOW,BARSLAST(立桩量)),COLORYELLOW,NODRAW,LINETHICK1;
买线:=EMA(C,4);
卖线:=EMA(SLOPE(C,20)*10+C,35);
DRAWICON(CROSS(卖线,买线),HIGH*1.02,8);
均价线:=AMOUNT/V/100;
C2:=REF(C,1);
涨停:=IF(REF(C,1)*1.1-C<0.01,1,0);
STICKLINE(涨停,OPEN,CLOSE,3,0),COLORRED;
STICKLINE(涨停,OPEN,CLOSE,1,0),COLORYELLOW;
STICKLINE(涨停,H,L,0,0),COLORYELLOW;
B1:='┄┄┄┄┄';
DRAWTEXT(均价线AND涨停,均价线,B1),COLORGREEN;
B3:='┄┄┄┄┄';
DRAWTEXT((O+C)/2AND涨停,(O+C)/2,B3),COLORMAGENTA;
B2:='┄┄┄┄┄';
DRAWTEXT(涨停,L,B2),COLORGRAY;
支撑线:(MA(CLOSE,3)+MA(CLOSE,6)+MA(CLOSE,12)+MA(CLOSE,24))/4,NODRAW;
除业绩后退股:=FINANCE(30)>=REF(FINANCE(30),130);
D0:=除业绩后退股;
D2:=IF(NAMELIKE('S'),0,1);
D3:=IF(NAMELIKE('*'),0,1);
D4:=DYNAINFO(17)>0;
去除大盘股:=CAPITAL/1000000<50;
去高价:=C<=75;
去掉:=D0ANDD2ANDD3ANDD4AND去除大盘股AND去高价AND
NOT(C>=REF(C,1)*1.097ANDC=OANDH=L);
MA5:=EMA(C,5);
YCXN:=MA5>=REF(MA5,1);
AA1:=REF(CLOSE,1)<(LLV(LOW,10)+(HHV(HIGH,10)-LLV(LOW,10))*1);
AA2:=CLOSE<HHV(HIGH,5)ANDCROSS(C,MA(C,5))ANDCROSS(C,MA(C,10))AND
CROSS(C,MA(C,20))
ANDCROSS(C,MA(C,34))ANDC/REF(C,1)>=1;
AA3:=CLOSE>=HHV(HIGH,5)ANDYCXNANDC/REF(C,1)>=1;
涨停狙击:=DYNAINFO(4)>0
ANDHHV(HIGH,5)/LLV(LOW,5)<3.4ANDAA1AND(AA2ORAA3);
L0:=(LLV(LOW,10));
L10:=(LLV(LOW,60));
L2:=(LLV(LOW,120));
A1:=REF(CLOSE,1);
B10:=COUNT(L10,13)>=8;
B20:=SUM(L10,13)>=6;
B30:=COUNT(-B20,13)>=10;
B4:=1;
B5:=COUNT(B20,13)>=1;
C1:=(((CLOSE-A1)/A1)*100)>2.5;
D10:=(((CLOSE-LOW)/LOW)*100)>2;
火牛:=IF((D10ANDL2ANDC1)*2,10,0);
金牛:=IF((D10ANDL0ANDC1)*2.5,10,0);
陡峭度:=IF((BARSCOUNT(CLOSE)>7),(100)*((MA(CLOSE,7))/(LLV(MA(CLOSE,7),7))-
1),1);
NN:=IF((陡峭度>0.35),6,65);
VAR17:=((-((100)*(HHV(HIGH,NN)-CLOSE))/(HHV(HIGH,NN)-LLV(LOW,NN))))*((DATE
<20070110));
狂喜:=(30)*(CROSS(VAR17,(-2)));
最牛妖
股:=EMA((CLOSE-MA((2*CLOSE+HIGH+LOW)/4,3))/MA((2*CLOSE+HIGH+LOW)/4,3)*1
50,2);
XG:=CROSS(最牛妖股,3);
黑马显形:=金牛AND火牛AND涨停狙击
AND狂喜AND去掉;
DRAWTEXT(黑马显形,LOW,'妖股'),COLORGREEN;
DRAWTEXT_FIX(1,0.50,5,0,'~☆~牛长老优化518754178~☆~'),COLORGREEN;
二、彩色k线指标源码
VOLA:=VOL;
五日:MA(VOL,5),coloryellow;
十日:MA(VOL,10),COLORGREEN;
二十日:MA(VOL,20),COLORRED;
Var1:=LLV(LOW,144);
Var2:=CLOSE;
Var3:=1.191*Var1;
Var4:=1.382*Var1;
Var5:=1.618*Var1;
Var6:=1.809*Var1;
Var7:=1.9*Var1;
Var8:=MA(CLOSE,5);
弱势:STICKLINE(Var2<Var3,VOLA,0,4,0),COLORFFFF99;
STICKLINE(Var2<Var3,VOLA*0.4,0,4,0),COLORFFCC99;
STICKLINE(Var2<Var3,VOLA*0.2,0,4,0),COLORFF9999;
反弹:STICKLINE(Var2>Var3,VOLA,0,4,0),COLOR66FF00;
STICKLINE(Var2>Var3,VOLA*0.4,0,4,0),COLOR66CC00;
STICKLINE(Var2>Var3,VOLA*0.2,0,4,0),COLOR669900;
安全:STICKLINE(Var2>Var4,VOLA,0,4,0),COLORFF00FF;
STICKLINE(Var2>Var4,VOLA*0.4,0,4,0),COLORCC00FF;
STICKLINE(Var2>Var4,VOLA*0.2,0,4,0),COLOR9900FF;
突破:STICKLINE(Var2>Var5,VOLA,0,4,0),COLOR00FFFF;
STICKLINE(Var2>Var5,VOLA*0.4,0,4,0),COLOR00CCFF;
STICKLINE(Var2>Var5,VOLA*0.2,0,4,0),COLOR0099FF;
疯牛:STICKLINE(Var2>Var6,VOLA,0,4,0),COLOR0000FF;
抛压:STICKLINE(Var2>Var6ANDVar2<Var8,VOLA,0,4,0),COLORFFCC00;
STICKLINE(Var2>Var6ANDVar2<Var8,VOLA*0.4,0,4,0),COLORFF9900;
STICKLINE(Var2>Var6ANDVar2<Var8,VOLA*0.2,0,4,0),COLORCC6600;
危险:STICKLINE(high>Var7,0.5*VOLA,0,4,0),COLORCCCCFF;
STICKLINE(high>Var7,0.2*VOLA,0,4,0),COLORwhite;
M1:=30;
M2:=3;
VA:=IF(CLOSE>REF(CLOSE,1),HSL,-HSL);
A:=SUM(IF(CLOSE=REF(CLOSE,1),0,VA),0);
DRAWBAND(MA(A,M2),RGB(150,50,50),MA(A,30),RGB(83,123,68));
OBV:A;
MAOBV1:MA(A,M1);
DRAWICON(CROSS(MA(A,M2),MAOBV1),MAOBV1-1,1);
DRAWICON(CROSS(MAOBV1,MA(A,M2)),MAOBV1+1,2);
T线:HHV(OBV,60),COLOR00FF00,DOTLINE;
最后阳线:=CURRBARSCOUNTO;
阳高:REFX(HHV(H,BARSLAST(NOT(C>O))),IF(最后阳
线,CURRBARSCOUNT-1,BARSNEXT(NOT(C>O))-1));
阳低:REFX(LLV(L,BARSLAST(NOT(C>O))),IF(最后阳
线,CURRBARSCOUNT-1,BARSNEXT(NOT(C>O))-1));
阳开:REFX(REF(O,BARSLAST(NOT(C>O))-1),IF(最后阳
线,CURRBARSCOUNT-1,BARSNEXT(NOT(C>O))-1));
阳收:REFX(C,IF(最后阳线,CURRBARSCOUNT-1,BARSNEXT(NOT(C>O))-1));
{后阳高:CONST(HHV(H,BARSLAST(C<O)));
后阳低:CONST(LLV(L,BARSLAST(C<O)));}
STICKLINE(阳高>阳低,阳高,阳低,4,0),COLORC080FF;
STICKLINE(阳开<阳收,阳开,阳收,4,0),COLORYELLOW;
STICKLINE(阳开>阳收,阳开,阳收,4,0),COLORBLUE;
{m}
最后阴线:=CURRBARSCOUNT=O))ANDC<O;
阴高:REFX(HHV(H,BARSLAST(NOT(C<O))),IF(最后阴
线,CURRBARSCOUNT-1,BARSNEXT(NOT(C<O))-1));
阴低:REFX(LLV(L,BARSLAST(NOT(C<O))),IF(最后阴
线,CURRBARSCOUNT-1,BARSNEXT(NOT(C<O))-1));
阴开:REFX(REF(O,BARSLAST(NOT(C<O))-1),IF(最后阴
线,CURRBARSCOUNT-1,BARSNEXT(NOT(C<O))-1));
阴收:REFX(C,IF(最后阴线,CURRBARSCOUNT-1,BARSNEXT(NOT(C<O))-1));
{后阴高:CONST(HHV(H,BARSLAST(C>O)));
后阴低:CONST(LLV(L,BARSLAST(C>O)));};
STICKLINE(阴高>阴低,阴高,阴低,4,0),COLOR404000;
STICKLINE(阴开<阴收,阴开,阴收,4,0),COLOR0080FF;
STICKLINE(阴开>阴收,阴开,阴收,4,0),COLOR008000;
DRAWKLINE(HIGH,OPEN,LOW,CLOSE);
N:=20;
N1:=7;
N2:=69;
T1:=IF((DATE<=1341231),1,0);
VAR2:=(CLOSE+HIGH+LOW)/(3);
VAR3:=(EMA(VAR2,10))*(T1);
VAR4:=(REF(VAR3,1))*(T1);
STICKLINE((VAR3>VAR4),VAR3,VAR4,4,0),COLORRED;
STICKLINE((VAR3<VAR4),VAR3,VAR4,4,0),COLOR00FF0F;
[源码注释]通达信公式动态翻译结果
X_1赋值:1日前的152日内最低价的最低值
X_2赋值:日期日X_1
X_3赋值:日期日X_2
X_4赋值:X_3=最低价 AND (最高价+最低价<开盘价+收盘价 OR 开盘价+最低价<最高价+开盘价)
X_5赋值:当满足条件X_4时,在最低价*1位置书写文字
XG赋值:X_4 AND 流通股本(股)<15000000512 AND 量比>0.5,NODRAW
输出先于庄家:XG,NODRAW
当满足条件XG>1日前的XGANDXG>0时,在0和XG位置之间画柱状线,宽度为6,0不为0则画空心柱.,COLOR660066
当满足条件XG>1日前的XGANDXG>0时,在0和XG位置之间画柱状线,宽度为3,0不为0则画空心柱.,画红色
当满足条件XG>1日前的XGANDXG>0时,在0.95位置画25号图标
当满足条件XG>1日前的XGANDXG>0时,在0.8位置画26号图标
当满足条件XG>1日前的XGANDXG>0时,在0.65位置画24号图标
当满足条件XG>1日前的XGANDXG>0时,在0.45位置画9号图标
当满足条件XG时,在0.75位置书写文字,画黄色
推荐阅读:见底变色k线指标公式
MA5:MA(C,5),COLORFF00FF,LINETHICK2;
MA10:MA(C,10),COLOR00FFFF,LINETHICK2;
MA21:MA(C,21),COLORFFFFFF,LINETHICK2;
BIAS:=(CLOSE-MA(CLOSE,6))/MA(CLOSE,6)*100;
BIASMA:=MA(BIAS,21);
AA:=BIAS>=BIASMA;
BB:=BIAS<BIASMA;
STICKLINE(AA,C,O,3,0),COLORRED;
STICKLINE(AA,H,L,0.5,0),COLORRED;
STICKLINE(BB,C,O,3,0),COLOR00FF00;
STICKLINE(BB,H,L,0.5,0),COLOR00FF00;
A5:=HHV(H,15)/LLV(L,15)>=1.25ANDNOT(L=LLV(L,30));
A7:=MA(C,70)>REF(MA(C,70),1)ANDREF(MA(C,70),1)>REF(MA(C,70),2);
A1:O<REF(L,1)ANDO/C>=1.02ANDC/L>=1.03ANDA5ANDA7ANDNOT(O=H);
LC:=REF(CLOSE,1);
RSI6:SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100,LINETHICK2;
MA6:MA(RSI6,6),COLORGREEN;
IF(MA6>REF(MA6,1)ORRSI6>MA6,MA6,DRAWNULL),COLORRED,LINETHICK2;
DRAWGBK(C>O,RGB(60,0,0),RGB(0,0,0),1,2,1);
N:=5;
JJ:=(HIGH+LOW+CLOSE)/3;
QJ0:=VOL/IF(HIGH=LOW,4,HIGH-LOW);
QJ1:=IF(CAPITAL=0,QJ0*(JJ-MIN(CLOSE,OPEN)),QJ0*IF(HIGH=LOW,1,(MIN(OPEN,CLOSE)-LOW)));
QJ2:=IF(CAPITAL=0,QJ0*(MIN(OPEN,CLOSE)-LOW),QJ0*IF(HIGH=LOW,1,(JJ-MIN(CLOSE,OPEN))));
QJ3:=IF(CAPITAL=0,QJ0*(HIGH-MAX(OPEN,CLOSE)),QJ0*IF(HIGH=LOW,1,(HIGH-MAX(OPEN,CLOSE))));
QJ4:=IF(CAPITAL=0,QJ0*(MAX(CLOSE,OPEN)-JJ),QJ0*IF(HIGH=LOW,1,(MAX(CLOSE,OPEN)-JJ)));
DDX:((QJ1+QJ2)-(QJ3+QJ4))/IF(CAPITAL=0,1000000,10000),COLOR00AAAA,LINETHICK;
V2:=SMA(IF(C>=REF(C,1),DDX,-DDX/100),2,1);
V5:SMA(V2*240/FROMOPEN*0.9,5,1);
V10:SMA(V5,5,1);
V20:SMA(V10,5,1);
DRAWKLINE(V2*1.01,REF(V2,1),REF(V2,1)*0.99,V2);
当日DDX:DDX,NODRAW;
STICKLINE(CURRBARSCOUNT=1ANDC>=REF(C,1),REF(V2,1),MAX(V2*0.98,V2*240/FROMOPEN*0.8),3,-1),COLORLIMAGENTA;
STICKLINE(CURRBARSCOUNT=1ANDC<REF(C,1),REF(V2,1),MIN(V2,V2*240/FROMOPEN*0.8),3,-1),COLORLIGREEN;
DRAWTEXT(CROSS(V2,REF(V2,1)*1.2)ANDLONGCROSS(CLOSE,REF(C,1)*1.025,4)ANDDDX/REF(MA(DDX,5),1)>2,REF(V2,1),'★'),COLORMAGENTA;
每日公式解答:
公式编写要求:
涨停后下挫8%的预警公式。
公式编写方法:
AA:=IF(FINANCE(3)=3ORFINANCE(3)=4,H=ZTPRICE(REF(C,1),0.2),H=ZTPRICE(REF(C,1),0.1))&&C<H;
XG:AAANDC/REF(C,1)<=0.92;
评论(0)