通达信指标公式源码概况:指标类别: 通达信指标公式授权方式: 免费版指标评级: ★★★★★指标分类: 策略画线方法: 副图一、通达信红买蓝卖指标公式源码 VAR01B:=(HHV(HIGH,9)-CLOSE)/(HHV(HIGH,9)-LLV(LOW,9))*100-70; VAR02B:=SMA(VAR01B,9,1)+100; VAR03B:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100; VAR04B:=SMA(VAR03B,3,1); VAR05B:=SMA(VAR04B,3,1)+100; VAR06B:=VAR05B-VAR02B; VAR12Q:=REF(LOW,1); VAR13Q:=SMA(ABS(LOW-VAR12Q),3,1)/SMA(MAX(LOW-VAR12Q,0),3,1)*100; VAR14Q:=EMA(IF(CLOSE*1.3,VAR13Q*10,VAR13Q/10),3); VAR15Q:=LLV(LOW,30); VAR16Q:=HHV(VAR14Q,30); VAR17Q:=IF(MA(CLOSE,58),1,0); VAR18Q:=EMA(IF(LOW =VAR15Q,(VAR14Q+VAR16Q*2)/2,0),3)/999*VAR17Q; 逃顶:CROSS(82,RSI); 量(万手):VOL/10000,NODRAW,VOLSTICK,COLORGREEN; {流通盘(亿手):CAPITAL/1000000,NODRAW,COLORLIGRAY; 年收益:FINANCE(33),NODRAW,COLORCYAN; 每股净资:FINANCE(34),NODRAW,COLORGREEN;} 股东权益:FINANCE(36),NODRAW,COLORMAGENTA; 每股公积:FINANCE(18)/1,NODRAW,COLORRED; {换手率:VOL/CAPITAL*100,NODRAW,COLORRED;} 逐笔买卖差:(LARGEINTRDVOL-LARGEOUTTRDVOL)/10000,COLORBROWN,NODRAW; 主动买卖差:(ACTINVOL-ACTOUTVOL)/10000,COLORBROWN,NODRAW; A01:=DYNAINFO(7); A03:=BARSCOUNT(CLOSE); A04:=(SMA((CLOSE/HHV(HIGH,120)),3,1)*100); A05:=IF((A03 20),A04,0); A06:=IF((LOW A01),0,IF((HIGH A01),1,(((A01-LOW)+0.009)/((HIGH-LOW)+0.009)))); A07:=DMA(A06,(VOL/CAPITAL))*60; A09:=IF((((A07 0)AND(A07 REF(A07,1)))AND(A05 =88)),A07,0); VAR1:=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); VAR2:=EMA(VAR1,8); VAR3:=3*SMA((C-LLV(L,55))/(HHV(H,55)-LLV(L,55))*100,5,1)-2*SMA(SMA((C-LLV(L,55))/(HHV(H,55)-LLV(L,55))*100,5,1),3,1); 趋势:=EMA(VAR3,3)-10; STICKLINE((A09 0)AND趋势 40,0,V/40000,2,0),COLORMAGENTA; A011:=DYNAINFO(5); A013:=BARSCOUNT(HIGH); A014:=(SMA((HIGH/HHV(CLOSE,120)),3,1)*100); A015:=IF((A013 20),A014,0); A016:=IF((HIGH A011),0,IF((LOW A011),1,(((A011-HIGH)+0.009)/((LOW-HIGH)+0.009)))); A017:=DMA(A016,(VOL/CAPITAL))*60; A019:=IF((((A017 0)AND(A017 REF(A017,1)))AND(A015 =88)),A017,0); VAR21:=3*SMA((CLOSE-HHV(HIGH,27))/(LLV(LOW,27)-HHV(HIGH,27))*100,5,1)- 2*SMA(SMA((HIGH-HHV(HIGH,27))/(LLV(LOW,27)-HHV(HIGH,27))*100,5,1),3,1); VAR22:=EMA(VAR21,8); VAR23:=3*SMA((HIGH-HHV(HIGH,55))/(LLV(LOW,55)-HHV(HIGH,55))*100,5,1)- 2*SMA(SMA((HIGH-HHV(HIGH,55))/(LLV(LOW,55)-HHV(HIGH,55))*100,5,1),3,1); 趋势1:=EMA(VAR23,3)-10; STICKLINE((A019 0AND(趋势1 20OR趋势1 REF(趋势1,1)AND趋势1 50)),0,V/40000,2,0),COLORGREEN; B2:DRAWICON(CROSS(ZIG(3,6),REF(ZIG(3,6),1)),V/10000,1); S2:DRAWICON(CROSS(REF(ZIG(3,4),1),ZIG(3,4)),V/10000,2); AA1:=IF(CURRBARSCOUNT=1ANDPERIOD=5,VOL*240/FROMOPEN,DRAWNULL); 预量:AA1/10000,COLORWHITE; 昨:(REF(V,1))/10000,COLORFFFF00,NODRAW; M20:MA(VOL/10000,20),COLORGREEN; M3:MA(VOL/10000,3),COLORYELLOW; 超B:=L2_AMO(0,2)/10000.0; 大B:=L2_AMO(1,2)/10000.0; 中B:=L2_AMO(2,2)/10000.0; 小B:=L2_AMO(3,2)/10000.0; 超S:=L2_AMO(0,3)/10000.0; 大S:=L2_AMO(1,3)/10000.0; 中S:=L2_AMO(2,3)/10000.0; 小S:=L2_AMO(3,3)/10000.0; 净流入:=(超B+大B+中B+小B)-(超S+大S+中S+小S),NODRAW; 超大单:=(超B)-(超S),NODRAW; 大单:=(大B)-(大S),NODRAW; 中单:=(中B)-(中S),NODRAW; 小单:=(小B)-(小S),NODRAW; DAZHI:=CONST(MAX(ABS(净流入),MAX(ABS(超大单),MAX(ABS(大单),MAX(ABS(中单),ABS(小单)))))),NODRAW; DRAWRECTREL(0,0,180,999.4,IF(120,RGB(10,0,0),0)); DRAWRECTREL(0,CONST(830-(ABS(净流入)*500/DAZHI)),30,935,IF(CONST(净流入) 0,RGB(100,0,0{255,0,255}),RGB(0,100,100))); DRAWRECTREL(35,CONST(830-(ABS(超大单)*500/DAZHI)),65,935,IF(CONST(超大单) 0,RGB(100,0,0),RGB(0,50,0))); DRAWRECTREL(70,CONST(830-(ABS(大单)*500/DAZHI)),100,935,IF(CONST(大单) 0,RGB(100,0,0),RGB(0,50,0))); DRAWRECTREL(105,CONST(830-(ABS(中单)*500/DAZHI)),135,935,IF(CONST(中单) 0,RGB(100,0,0),RGB(0,50,0))); DRAWRECTREL(140,CONST(830-(ABS(小单)*500/DAZHI)),170,935,IF(CONST(小单) 0,RGB(100,0,0),RGB(0,50,0))); DRAWTEXT_FIX(CURRBARSCOUNT=1,0.002,0.98,0, 净流超大大单中单小单 ),COLORYELLOW; DRAWTEXT_FIX(CURRBARSCOUNT=1,0,0,0, 资金搏弈(万元) ),COLORYELLOW; DRAWNUMBER_FIX(CURRBARSCOUNT=1,0.002,0.55,0,INTPART(净流入)),COLORWHITE; DRAWNUMBER_FIX(CURRBARSCOUNT=1,0.036,0.30,0,INTPART(超大单)),COLORWHITE; DRAWNUMBER_FIX(CURRBARSCOUNT=1,0.070,0.55,0,INTPART(大单)),COLORWHITE; DRAWNUMBER_FIX(CURRBARSCOUNT=1,0.106,0.30,0,INTPART(中单)),COLORWHITE; DRAWNUMBER_FIX(CURRBARSCOUNT=1,0.145,0.55,0,INTPART(小单)),COLORWHITE; DRAWTEXT_FIX(1,0,0.20,0,STRCAT( 【涨停原因】 ,EXTERNSTR(0,22))),COLORDB11E5; {参数;N(2,100,14)N1:(1,10,3)} TYP:=(HIGH+LOW+CLOSE)/3; CCI:(TYP-MA(TYP,N))/(0.015*AVEDEV(TYP,N)),LINESTICK,COLORRED,LINETHICK2; 跌:IF(CCI REF(CCI,1),CCI,DRAWNULL),COLORGREEN,LINETHICK2; DRAWICON(CROSS(200,CCI),250,27); DRAWICON(CROSS(CCI,-200),-250,26); 转强:STICKLINE(CCI 0,0,CCI,2,0),COLOR770077; STICKLINE(CCI 0,0,CCI,1.5,0),COLOR990099; STICKLINE(CCI 0,0,CCI,0.8,0),COLORBB00BB; STICKLINE(CCI 0,0,CCI,0.3,0),COLORFF00FF; 转弱:STICKLINE(CCI 0,0,CCI,2,0),COLOR888800; STICKLINE(CCI 0,0,CCI,1.5,0),COLORAAAA00; STICKLINE(CCI 0,0,CCI,0.8,0),COLORDDDD00; STICKLINE(CCI 0,0,CCI,0.3,0),COLORFFFF00; 弱转强:=STICKLINE(CROSS(CCI,-200)ANDCCI REF(CCI,1),CCI,0,2,0),COLOR00DFDF; STICKLINE(弱转强,-150,0,7,0),COLORYELLOW; STICKLINE(弱转强,-150,0,4,0),COLOR000099; STICKLINE(弱转强,-150,0,2,0),COLOR0000BB; STICKLINE(弱转强,-150,0,1,0),COLOR0000DD; STICKLINE(弱转强,-210,0,0.9,0),COLOR0000FF; DRAWTEXT(弱转强,-210, 买 ),COLORYELLOW; 强转弱:=STICKLINE(CROSS(200,CCI)ANDCCI REF(CCI,1),0,CCI,2,0),COLORGREEN; STICKLINE(强转弱,150,0,7,0)COLORWHITE; STICKLINE(强转弱,150,0,4,0),COLOR009900; STICKLINE(强转弱,150,0,2,0),COLOR00BB00; STICKLINE(强转弱,150,0,1,0),COLOR00DD00; STICKLINE(强转弱,210,0,0.9,0),COLOR00FF00; DRAWTEXT(强转弱,210, 卖 ),COLORGREEN; 天顶线:=200,COLORRED; 地底线:-200,COLORCYAN; 牛熊线:100,POINTDOT,LINETHICK3,COLORWHITE; BIAS1W:=(CLOSE-MA(CLOSE,6))/MA(CLOSE,6)*100; BIAS2W:=(CLOSE-MA(CLOSE,12))/MA(CLOSE,12)*100; BIAS3W:=(CLOSE-MA(CLOSE,24))/MA(CLOSE,24)*100; MM:=(BIAS1W+2*BIAS2W+3*BIAS3W)/6; MN:=MA(MM,3); VAR24:=LLV(LOW,36); VAR25:=HHV(HIGH,30); VAR26:=EMA((CLOSE-VAR24)/(VAR25-VAR24)*4,4)*25; {底背离:=IF((VAR26 10),-100,-150),COLORYELLOW,LINETHICK1;} 底背离:IF(MN -4,-100,-150),COLORYELLOW,LINETHICK1; 顶背离:IF((VAR26 90),150,200),COLORGREEN,LINETHICK1; 量能:MA(100*(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N)),N1),COLORYELLOW,LINETHICK1; var1:=COST(10)*0; var2:=99990905; var3:=IF(DATE =var2,1,0); var4:=(LOW+HIGH+CLOSE)/3*var3; 操作:MA(var4,5); 拉升:HHV(操作,13); 压力:HHV(操作,60)*var3; 买卖:LLV(操作,13); 底部支撑:LLV(LOW,60)*1.02*var3; 顶部:HHV(HIGH,60)*0.98*var3; var5:=EMA(WINNER(COST(50)),4); var6:=EMA(WINNER(CLOSE),4)-var5; var7:=EMA(var6,8); var8:=2*(var6-var7); var9:=3*var6-2*var7*var3; varA:=LLV(LOW,36); varB:=HHV(HIGH,30); varC:=EMA((CLOSE-varA)/(varB-varA)*4,4)*25*var3; varD:=varC; varE:=(varC-LLV(varC,4))/(HHV(varC,4)-LLV(varC,4))*4*25*var3; varF:=CROSS(varE,87.5)ANDvarD 40;二、通达信k线红绿公式源码 SHORT:=6; LONG:=13; MID:=5; DIF:EMA(CLOSE,SHORT)-EMA(CLOSE,LONG); DEA:EMA(DIF,MID); MACD:(DIF-DEA)*2,COLORSTICK; A:=BARSLAST(FILTERX(MACD=HHV(MACD,BARSLAST(MACD 0)),BARSLAST(MACD 0))); B:=REF(MACD,A); TT:=A+1; ZTT:=REF(TT,TT)+TT; KK:=REF(MACD,ZTT-1); IF(CURRBARSCOUNT CONST(ZTT+1),REFDATE(KK,DATE),DRAWNULL),COLORGREEN; KP:=SMA(AMOUNT,10,1)/10000; VAR1:=REF(KP,1); VAR2:=REF(KP,2); VAR3:=REF(KP,3); COUNT(KP VAR1,1)andVAR1 VAR2andVAR2 VAR3; ma1:ma(c,5); ma2:ma(c,10); ma3:MA(CLOSE,30); STICKLINE(c 0,o,c,8,0),ColorGREEN; STICKLINE(c 0,h,l,0.8,0),ColorGREEN; a:=close ma1andCLOSE ma2; b:=close ma1andCLOSE ma2andCLOSE ma3; STICKLINE(a 0,o,c,8,0),COLORred; STICKLINE(a 0,h,l,0.8,0),COLORred; STICKLINE(b 0,h,l,0.8,0),ColorGREEN; STICKLINE(b 0,o,c,8,0),ColorGREEN; IFBARSTATUS=2andc 800andaTHEN DRAWTEXTABS(390,26, 红k线,当前处于持股阶段。 ),color0000FF,LINETHICK3; IFBARSTATUS=2andc 800andc ma2THEN DRAWTEXTABS(390,26, 绿k线,当前处于持币阶段。 ),ColorGREEN,LINETHICK3; IFBARSTATUS=2andc 800andaTHEN DRAWTEXTABS(390,26, 红k线,大盘当前处于持股阶段。 ),color0000FF,LINETHICK3; IFBARSTATUS=2andc 800andc ma2THEN DRAWTEXTABS(390,26, 绿k线,大盘当前处于持币阶段。 ),ColorGREEN,LINETHICK3; {大量:=HHV(V,20); 天数:BARSLAST(v=大量),LINETHICK0; 大量收盘价:REF(C,天数),LINETHICK0; STICKLINE(大量收盘价and天数 0,大量收盘价,大量收盘价,20,0),ColorFF9900;};[源码注释]通达信公式动态公式解读HJ_1赋值:(收盘价的3日简单移动平均+收盘价的6日简单移动平均+收盘价的12日简单移动平均+收盘价的24日简单移动平均)/4HJ_2赋值:HJ_1的3日简单移动平均HJ_3赋值:5日前的最低价 5日前的HJ_2 OR 4日前的最低价 4日前的HJ_2 OR 3日前的最低价 3日前的HJ_2 OR 2日前的最低价 2日前的HJ_2 OR 1日前的最低价 1日前的HJ_2HJ_4赋值:(收盘价-1日前的收盘价)/1日前的收盘价*100HJ_5赋值:HJ_4 9.85 AND 取反HJ_6赋值:HJ_5的5日累和 2 AND HJ_5 AND 收盘价 HJ_2 AND HJ_3HJ_7赋值:上次HJ_6距今天数日前的收盘价HJ_8赋值:HJ_5 AND 最低价 HJ_2*1.05输出XG:HJ_6 AND HJ_8 AND 量比 0推荐阅读:通达信红蓝线公式 VAR1:=SAR(10,2,20); S:IF(VAR1 C,VAR1,DRAWNULL),COLORRED,CIRCLEDOT; X:IF(VAR1 C,VAR1,DRAWNULL),COLORGREEN,CIRCLEDOT; B1:=REF(C,1);B2:=REF(C,2); SS:=IF(C REF(C,1)ANDREF(C,1) =REF(C,2),1,IF(C REF(C,1)ANDREF(C,1) =REF(C,2),-1,IF(C REF(C,2)ANDREF(C,2) REF(C,1),2,IF(C REF(C,2)ANDREF(C,2) REF(C,1),-2,0)))); SM:=IF(REF(SS,1) 0ORREF(SS,1) 0,REF(SS,1),IF(REF(SS,2) 0ORREF(SS,2) 0,REF(SS,2),IF(REF(SS,3) 0ORREF(SS,3) 0,REF(SS,3),IF(REF(SS,4) 0ORREF(SS,4) 0,REF(SS,4),IF(REF(SS,5) 0ORREF(SS,5) 0,REF(SS,5),IF(REF(SS,6) 0ORREF(SS,6) 0,REF(SS,6),IF(REF(SS,7) 0ORREF(SS,7) 0,REF(SS,7),0))))))); MC:IF(REF(SS,1) 0ORREF(SS,1) 0,B2,IF(SM 0,MIN(B1,B2),MAX(B1,B2))),COLORFF00FF; STICKLINE(SS=1ORSM =1ANDSS=0,B1,C,0.8,1),COLORRED; STICKLINE(SS=-1ORSM =-1ANDSS=0,B1,C,0.8,0),COLORFF9000; STICKLINE(SS=2,B2,C,0.8,1),COLORRED; STICKLINE(SS=-2,B2,C,0.8,0),COLORFF9000; STICKLINE((SS=-1ORSS=-2)ANDSM 0,B2,B1,0.8,1),COLORRED; STICKLINE((SS=1ORSS=2)ANDSM 0,B2,B1,0.8,0),COLORFF9000; 周期:=15;过滤:=8; 选股1:=-26;抄底:=-40;红鸟庄家抄底王:0,COLORFF00FF,POINTDOT; VAR2:=MA(CLOSE,5); VAR3:=MA(CLOSE,10); VAR4:=MA(CLOSE,20); VAR5:=MA(CLOSE,30); VAR6:=(VAR2+VAR3+VAR4+VAR5)/(4); VAR7:=((VAR6-REF(VAR6,周期))/(REF(VAR6,周期)))*(100); VAR8:=((VAR6-REF(VAR6,周期))/(REF(VAR6,周期)))*(100); VAR9:=EMA(VAR7,过滤); 红包:IF((TROUGHBARS(3,15,1)=0)AND(HIGH LOW+0.01),10,(-5)),COLOR00FF00; 反转:STICKLINE(VAR9 1*REF(VAR9,1),VAR7,0,5,0),COLOREE00EE; 持股:STICKLINE(VAR7 1*REF(VAR7,1),VAR7,VAR9,5,0),COLORRED; 持币:STICKLINE(VAR7 1*REF(VAR7,1),VAR7,VAR9,5,1),COLORGREEN; 洗盘:STICKLINE(VAR7 1*REF(VAR7,1)ANDVAR9 1*REF(VAR9,1),VAR7,VAR9,10,0),COLOR00EEFF; VAR10:=((CLOSE-MA(CLOSE,58))/(MA(CLOSE,58)))*(100); VAR11:=((VAR10 (1)*(REF(VAR10,1)))AND(VAR10 选股1)AND(VAR10 抄底))*(1.5); VAR12:=((VOL)/(CAPITAL))*(100); VAR13:=LLVBARS(LOW,50); VAR14:=SUM(VOL,VAR13); VAR15:=HHVBARS(HIGH,50); VAR16:=SUM(VOL,VAR15); VAR17:=((CLOSE-REF(OPEN,VAR15))/(REF(OPEN,VAR15)))*(100); VAR18:=((VAR16)/(CAPITAL))*(100); VAR19:=((CLOSE-REF(OPEN,VAR13))/(REF(OPEN,VAR13)))*(100); VAR20:=((VAR14)/(CAPITAL))*(100); VAR21:=MA(CLOSE,3); VAR22:=(REF(CLOSE,2))*(0.86500001); VAR23:=(REF(CLOSE,13))*(0.77200001); VAR24:=MIN(VAR22,VAR23); VAR25:=MA(CLOSE,13); 抄底王:(IF(((CLOSE-VAR24)/(CLOSE) 0.02999999)AND(VAR17 (-35))AND((SUM(VAR12,5))/(5) 1.8),1,0))*(10),COLORFFFFFF; DRAWTEXT(抄底王,抄底王, 成功率90追 ),COLORFFAA00; VAR26:=((CLOSE-REF(CLOSE,1))/(REF(CLOSE,1)))*(100); VAR27:=(EMA(CLOSE,12)-EMA(CLOSE,26))*(100); VAR28:=EMA(VAR27,9); VAR29:=(2)*(VAR27-VAR28); DRAWTEXT(VAR27 (-50)ANDVAR26 7ANDVAR27 VAR28,(-10), 底 ),COLORWHITE; DRAWTEXT(VAR27 (-50)ANDVAR26 7ANDVAR27 =VAR28,5, 追 ),COLORWHITE; STICKLINE(VAR27 (-50)ANDVAR26 7,0,(-10),5,0),COLORFFFF66; P1:=3; P2:=6; P3:=18; P4:=250; DRAWGBKLAST(C EMA(C,5),STRIP(RGB(0,0,80),RGB(80,0,0),1)); DRAWGBKLAST(C =EMA(C,5),STRIP(RGB(0,0,80),RGB(40,40,0),1)); DRAWGBKLAST(C =EMA(C,10),STRIP(RGB(0,0,180),RGB(0,80,0),1)); DRAWGBKLAST(C =EMA(C,20),STRIP(RGB(0,0,80),RGB(0,0,0),1)); {缺口} LL:=REF(L,1); HH:=REF(H,1); SQK:=L HH; XQK:=H LL; {DRAWTEXT(SQK,L*0.92, 上跳 ),COLORYELLOW; DRAWTEXT(XQK,H*1.08, 逃命 ),COLORGreen;} STICKLINE(SQK,L,HH,4*5,1),COLORYELLOW; STICKLINE(XQK,H,LL,4*5,2),COLORGreen; {红绿三角【副图】} A10304:=REF(HIGH,3)=HHV(HIGH,2*3+1); B10304:=FILTER(A10304,3); C10304:=BACKSET(B10304,3+1); D10304:=FILTER(C10304,3);{高点} A20304:=REF(LOW,3)=LLV(LOW,2*3+1); B20304:=FILTER(A20304,3); C20304:=BACKSET(B20304,3+1); D20304:=FILTER(C20304,3);{低点} E10304:=(REF(LLV(LOW,2*3),1)+REF(HHV(HIGH,2*3),1))/2; E20304:=(HIGH+LOW)/2;{高低点出现在同一K线上时可作取舍} H10304:=(D10304ANDNOT(D20304ANDE10304 =E20304))ORBARSTATUS=2ORBARSCOUNT(CLOSE)=1; L10304:=(D20304ANDNOT(D10304ANDE10304=E20304)); X10304:=REF(BARSLAST(H10304),1)+1; F10304:=BACKSET(H10304ANDCOUNT(L10304,X10304) 0,LLVBARS(IF(L10304,LOW,10000),X10304)); G10304:=F10304 REF(F10304,1); I10304:=BACKSET(G10304,2); LD0304:=I10304 REF(I10304,1);{过滤后低点} L20304:=LD0304ORBARSTATUS=2ORBARSCOUNT(CLOSE)=1; X20304:=REF(BARSLAST(L20304),1)+1; F20304:=BACKSET(L20304ANDCOUNT(H10304,X20304) 0,HHVBARS(IF(H10304,HIGH,0),X20304)); G20304:=F20304 REF(F20304,1); I20304:=BACKSET(G20304,2); HD0304:=I20304 REF(I20304,1);{过滤后高点} UU0304:=BACKSET(BARSTATUS=2,BARSLAST(LD0304)+1); VV0304:=UU0304 REF(UU0304,1); UU20304:=BACKSET(BARSTATUS=2,BARSLAST(HD0304)+1); VV20304:=UU20304 REF(UU20304,1); {以下语句为三角形部分} 底:REF(L,BARSLAST(VV0304)),COLORred,LINETHICK1; 顶:REF(H,BARSLAST(VV20304)),COLORGreen,LINETHICK1; {下跌三角形:红色三角形画完介入} StickLine(VV0304,顶,底,0,0),COLORred,LINETHICK3; DRAWLINE(VV20304,H,VV0304,L,0),COLORred,LINETHICK3;{斜} DRAWLINE(VV20304,H,VV0304,顶,0),COLORred,LINETHICK3; {上涨三角形:绿色三角形画完出局} StickLine(VV20304,顶,底,0,0),COLORGreen,linethick2; DRAWLINE(VV0304,L,VV20304,H,0),COLORGreen,linethick2;{斜} DRAWLINE(VV0304,L,VV20304,底,0),COLORGreen,linethick2; {文字} NN304:=DISPSTATUS=2; DRAWTEXT(nn304,底, 底: +NUMTOSTRN(底,2)+ 元 ),ALIGN2,COLORred,LINETHICK1,VALIGN0; DRAWTEXT(nn304,顶, 顶: +NUMTOSTRN(顶,2)+ 元 ),ALIGN2,COLORGreen,LINETHICK1,VALIGN2; {箱体} TY309:=C; HD309:=FILTER(BACKSET(FILTER(REF(TY309,10)=HHV(TY309,2*10+1),10),10+1),10); LD309:=FILTER(BACKSET(FILTER(REF(TY309,10)=LLV(TY309,2*10+1),10),10+1),10); A309:=REF(C,BARSLAST(HD309)); B309:=REF(C,BARSLAST(LD309)); T1309:=BARSLAST(HD309) BARSLAST(LD309)ANDNOT(HD309); T2309:=BARSLAST(HD309) BARSLAST(LD309)ANDNOT(LD309); 波浪顶:IF(T1309,A309,A309),COLORCYAN,POINTDOT,LINETHICK2; 波浪底:IF(T2309,B309,B309),COLORMAGENTA,POINTDOT,LINETHICK2; a:=HHV(MA((L+H+C)/3,3),3); b:=llv(MA((L+H+C)/3,3),10); STICKLINE(DISPSTATUS=2,a,a,20,0),Coloryellow,linethick1;{小箱体--上沿} DRAWTEXT(DISPSTATUS=2,a,NUMTOSTRN(a,3)),colorYELLOW; STICKLINE(DISPSTATUS=2,b,b,20,0),COLORWhite,linethick1;{小箱体--下沿} DRAWTEXT(DISPSTATUS=2,b,NUMTOSTRN(b,3)),COLORWhite; k1:=llv(l,barslast(DISPSTATUS=1)+1); aa1:=cost(95); aa2:=cost(5); ly:=(aa1-aa2)*100/(aa1+aa2); N:=p1;{原码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:=(D1ANDNOT(D2ANDE1 =E2))ORDISPSTATUS=2ORBARSCOUNT(C)=1; L1:=(D2ANDNOT(D1ANDE1 E2)); H2:=D1ANDNOT(D2ANDE1 =E2); X1:=REF(BARSLAST(H1),1)+1; F1:=BACKSET(H1ANDCOUNT(L1,X1) 0,LLVBARS(IF(L1,L,10000),X1)); G1:=F1 REF(F1,1); I1:=BACKSET(G1,2); LD:=I1 REF(I1,1);{过滤后低点} L2:=LDORDISPSTATUS=2ORBARSCOUNT(C)=1; X2:=REF(BARSLAST(L2),1)+1; F2:=BACKSET(L2ANDCOUNT(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(DISPSTATUS=2,BARSLAST(HD)+1);S1:=R1 REF(R1,1);{前一高} T1:=BACKSET(DISPSTATUS=2,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);{前四高} DRAWLINE(S2,H,S1,H,1),Color80FFFF;{★压力1:} DRAWLINE(U2,L,U1,L,1),POINTDOT,Color00FFFF,linethick1;{★支撑1:} DRAWLINE(S3,H,S2,H,1),ColorFF8000;{★压力2:} DRAWLINE(U3,L,U2,L,1),POINTDOT,ColorFF8000;{★支撑2:} DRAWLINE(S4,H,S3,H,1),Color0000FF;{★压力3:} DRAWLINE(U4,L,U3,L,1),POINTDOT,Color0000FF;{★支撑3:}; DRAWICON(S2,H*1.02,9);{高点红电池} DRAWICON(S3,H*1.02,9); DRAWTEXT(S2,H*1.035,NUMTOSTRN(H,2)),COLORMAGENTA,linethick2;{高价点位} DRAWTEXT(S1,H*1.035,NUMTOSTRN(H,2)),COLORMAGENTA,linethick2;{高价点位} DRAWTEXT(S3,H*1.035,NUMTOSTRN(H,2)),COLORMAGENTA,linethick2;{高价点位} DRAWICON(U1,L*0.98,10);{低点小红旗} DRAWICON(U2,L*0.98,10);{低点小红旗} DRAWICON(U3,L*0.98,10);{低点小红旗} DRAWICON(U4,L*0.98,10);{低点小红旗} DRAWTEXT(U1,L*0.96,NUMTOSTRN(L,2)),COLORCYAN,linethick2;{低价点位} DRAWTEXT(U2,L*0.96,NUMTOSTRN(L,2)),COLORCYAN,linethick2;{低价点位} DRAWTEXT(U3,L*0.96,NUMTOSTRN(L,2)),COLORCYAN,linethick2;{低价点位} DRAWTEXT(U4,L*0.96,NUMTOSTRN(L,2)),COLORCYAN,linethick2;{低价点位} {K线变色} {STICKLINE(open =close,close,open,0,0),COLOR00FF00; STICKLINE(open =close,close,open,8,0),COLOR008800; STICKLINE(open =close,close,open,7,0),COLOR009900; STICKLINE(open =close,close,open,6,0),COLOR00AA00; STICKLINE(open =close,close,open,5,0),COLOR00BB00; STICKLINE(open =close,close,open,4,0),COLOR00CC00; STICKLINE(open =close,close,open,3,0),COLOR00DD00; STICKLINE(open =close,close,open,2,0),COLOR00EE00; STICKLINE(open =close,close,open,1,0),COLOR00FF00; STICKLINE(close open,close,open,0,0),COLORFFBBFF; STICKLINE(close open,close,open,8,0),COLORFF00FF; STICKLINE(close open,close,open,7,0),COLORFF22FF; STICKLINE(close open,close,open,6,0),COLORFF44FF; STICKLINE(close open,close,open,5,0),COLORFF66FF; STICKLINE(close open,close,open,4,0),COLORFF88FF; STICKLINE(close open,close,open,3,0),COLORFF99FF; STICKLINE(close open,close,open,2,0),COLORFFAAFF; STICKLINE(close open,close,open,1,0),COLORFFBBFF;}; {基本面} DRAWTEXTABS(20,5, 所属板块: +BKNAME),COLORyellow; 流通盘大小:=FINANCE2(37)/1000000*100; DRAWTEXTABS(20,25, 上市日期: +STR(FINANCE2(2))+ 日 ),Coloryellow; DRAWTEXTABS(180,25, 总股本: +NUMTOSTR(FINANCE2(35)/10000)+ 亿 ),COLORyellow; DRAWTEXTABS(320,25, 流通股: +NUMTOSTR(CAPITAL/1000000)+ 亿 ),COLORyellow; DRAWTEXTABS(460,25, 限售A股: +NUMTOSTR(FINANCE2(41)/10000)+ 亿 ),COLORyellow; 每股收益:=FINANCE2(3); 每股市盈率:=DYNAINFO(39); 每股净资产:=FINANCE2(4); 销售毛利率:=FINANCE2(12); 主营收入同比:=FINANCE2(11); 净利润同比增长:=FINANCE2(10); 每股公积金:=FINANCE2(7); 每股未分配:=FINANCE2(8); DRAWTEXTABS(20,45, 销售毛利率: +NUMTOSTRN(销售毛利率,2)+ % ),COLORgreen; DRAWTEXTABS(20,65, 主营收入同比增长: +NUMTOSTRN(主营收入同比,2)+ % ),COLORgreen; DRAWTEXTABS(20,85, 净利润同比增长: +NUMTOSTRN(净利润同比增长,2)+ % ),COLORgreen; DRAWTEXTABS(20,105, 每股公积金: +NUMTOSTRN(每股公积金,2)+ 元 ),Colorgreen; DRAWTEXTABS(180,45, 每股收益: +NUMTOSTRN(每股收益,2)+ 元 ),COLORred; DRAWTEXTABS(180,65, 每股市盈率: +NUMTOSTRN(每股市盈率,1)+ 倍 ),COLORred; DRAWTEXTABS(180,85, 每股净资产: +NUMTOSTRN(每股净资产,2)+ 元 ),COLORred; DRAWTEXTABS(180,105, 每股未分配: +NUMTOSTRN(每股未分配,2)+ 元 ),Colorred; n1:=barslast(cross(c,MA(c,60))); n2:=barslast(cross(MA(c,60),c)); 建仓成本:=MAXCYC; 日换手率:=(VOL*100/CAPITAL);; 5日换手率:=SUM(日换手率,5);; 5日均量:=DYNAINFO(38); 压力位:=DMA(AMOUNT/(100*VOL),VOL/(100*FINANCE2(37)))*1.12; 强股排序:=if(n1 n2,n1+1,0); DRAWTEXTABS(320,45, 日换手率: +NUMTOSTRN(日换手率,3)),ColorF200F2; DRAWTEXTABS(460,45, 5日换手率: +NUMTOSTRN(5日换手率,3)),ColorF200F2; DRAWTEXTABS(320,65, 5日均量: +NUMTOSTRN(5日均量,0)+ 手 ),ColorF200F2; DRAWTEXTABS(460,65, 平均成本: +NUMTOSTRN(建仓成本,2)+ 元 ),ColorF200F2; DRAWTEXTABS(320,85, 股价上穿60均线: +NUMTOSTRN(强股排序,0)+ 天 ),ColorF200F2; DRAWTEXTABS(460,85, 心理成本压力: +NUMTOSTRN(压力位,2)+ 元 ),ColorF200F2; DRAWTEXTABS(320,105, 上涨家数: +NUMTOSTRN(INDEXADV,0)),COLORF200F2; DRAWTEXTABS(460,105, 下跌家数: +NUMTOSTRN(INDEXDEC,0)),COLORF200F2; drawtextabs(5,260, 【红三角】〓回调企稳形态【突破红三角后的回踩为假摔】〓 ),COLORred,linethick2; drawtextabs(5,285, 【红三角】〓回调企稳形态【画完介入 amp;突破介入】〓 ),COLORred,linethick2; drawtextabs(5,310, 【绿三角】〓突破前高形态【画完出局】〓 ),COLORGreen,linethick2; drawtextabs(5,335, 【绿三角】〓突破前高形态【未突破绿三角顶端的回调为真摔】〓 ),COLORGreen,linethick2; ST:=STRFIND(stkname, ST ,1); ZF:=(c-ref(c,1))/ref(c,1)*100; 涨停:=IF(ST 0,ZF =4.94,ZF =9.88); 跌停:=IF(ST 0,ZF =-4.94,ZF =-9.88); {涨停金柱} STICKLINE(涨停 =1,O,C,15,0),COLOR004444; STICKLINE(涨停 =1,O,C,13,0),COLOR004444; STICKLINE(涨停 =1,O,C,11,0),COLOR004444; STICKLINE(涨停 =1,O,C,10,0),COLOR004444; STICKLINE(涨停 =1,O,C,7,0),COLOR005555; STICKLINE(涨停 =1,O,C,6,0),COLOR006666; STICKLINE(涨停 =1,O,C,5,0),COLOR007777; STICKLINE(涨停 =1,O,C,4,0),COLOR009999; STICKLINE(涨停 =1,O,C,3,0),COLOR00bbbb; STICKLINE(涨停 =1,O,C,2,0),COLOR00dddd; STICKLINE(涨停 =1,O,C,1,0),COLOR00ffff; {DRAWTEXT(涨停 0,L*1.01, ↖涨停 ),COLOR00FFFF;} {跌停银柱} STICKLINE(跌停 =1,O,C,15,0),COLOR333333; STICKLINE(跌停 =1,O,C,13,0),COLOR333333; STICKLINE(跌停 =1,O,C,11,0),COLOR333333; STICKLINE(跌停 =1,O,C,10,0),COLOR333333; STICKLINE(跌停 =1,O,C,7,0),COLOR444444; STICKLINE(跌停 =1,O,C,6,0),COLOR555555; STICKLINE(跌停 =1,O,C,5,0),COLOR777777; STICKLINE(跌停 =1,O,C,4,0),COLOR999999; STICKLINE(跌停 =1,O,C,3,0),COLORbbbbbb; STICKLINE(跌停 =1,O,C,2,0),COLORdddddd; STICKLINE(跌停 =1,O,C,1,0),COLORffffff; {DRAWTEXT(跌停 0,H*1.01, ↙跌停 ),COLORFFFFFF;}; {LC:=REF(CLOSE,1); RSI:=((SMA(MAX((CLOSE-LC),0),3,1)/SMA(ABS((CLOSE-LC)),3,1))*100); FF:=EMA(CLOSE,3); MA15:=EMA(CLOSE,21); DRAWTEXT(CROSS(FF,MA15),(LOW*0.99), 底背离 ),ColorD8BFD8; DRAWTEXT(CROSS(88,RSI),(HIGH*1.02), 顶背离 ),COLOR00FFFF;} 三连阴:={COUNT(C REF(C,1),3) 2AND}COUNT(C =O,3) 2ANDREF(C,1) REF(C,2); 二缩量:=VOL =REF(VOL,1)ANDREF(VOL,1) REF(VOL,2); 三阴:=REF(ALL(C REF(C,1),2)ANDALL(C O,2),1)ANDABS(C-O)/O 0.03 ANDSUM((C-REF(C,1))/C*100,7) -8AND二缩量ANDIF(C O,C/O REF(O/C,1),O/C REF(O/C,1))AND REF(O/C REF(O/C,1),1); DRAWTEXT(三阴,H*1.01, 三阴 ),COLOR00dddd; {三长假跌} RC1:=REF(C,1); 比前跌率:=(RC1-C)*100/RC1; 长上影:=(H-MAX(C,O))/(H-L) =0.618;{这个可自调0.5-0.66} 不大跌:=比前跌率 =2;{这个可自调0.5-3} 长阴短柱:=比前跌率 =4ANDV HHV(V,30)/1.9; 长腿:=(MIN(C,O)-L)/(H-L) =0.382;{这个可自调0.3-0.66} 点左峰:=1;{暂时不考虑} XG1:=REF(长上影AND不大跌,2) 0 ANDREF(长阴短柱,1) 0 AND长腿AND点左峰; 三长假跌:=COUNT(XG1,3);{3天内出现信号选出,这个3可往大调,如果选不出}; DRAWTEXT(三长假跌,L*0.99, 三长 ),COLORf00ff0; 长阴短柱:=C/REF(C,1) 0.95ANDV HHV(V,30)/1.9; DRAWTEXT(长阴短柱,L*0.99, 长阴短 假阴真阳:=V REF(V,1)*1.5ANDO REF(C,1)ANDC OANDC REF(C,1); DRAWTEXT(假阴真阳,L*0.99, 假阴真阳 假阳真阴:=C OandC REF(C,1); DRAWTEXT(假阳真阴,H*1.01, 假阳真阴 每日公式解答:股票公式编写要求:收盘价阳线突破21日线,并且突破后3天不破站稳21日线的选股公式。股票公式编写结果:XG:CROSS(REF(C,2),MA(C,21) ) AND C MA(C,21);