通达信波段顶底预警提示公式源码分享

{背景色} DRAWGBK(O>0,RGB(33,47,58),RGB(0,0,0),0,'02',0); {现价游标} 现价:CONST(C),COLORCYAN,DOTLINE; {持股线} 持币:=MA(C,5);持股:IF(持币>=REF(持币,1),持币,DRAWNULL),COLORRED; {标缺口} LL:=REF(L,1);HH:=REF(H,1);上跳:=L>HH;下跳:=H<LL; STICKLINE(L>REF(H,1),L,REF(H,1),2.1,-1),COLORRED; STICKLINE(REF(L,1)>H,REF(L,1),H,1.8,-1),COLORGREEN; {多空波段分界线} 买线:=EMA(C,2);多空:EMA(SLOPE(C,30)*20+C,51),COLORWHITE; 涨家数:INDEXADV,NODRAW,COLORLIMAGENTA; 跌家数:INDEXDEC,NODRAW,COLORGREEN; {阳K线} STICKLINE(买线>=多空,L,H,0,0),COLORWHITE; STICKLINE(买线>=多空,C,O,2.1,1),COLORWHITE; {阴K线} STICKLINE(买线<多空,L,H,0,0),COLOR668800; STICKLINE(买线<多空,C,O,2.1,1),COLOR668800; {线上阳K线} STICKLINE(CROSS(买线,多空*0.991),O,C,2.1,0),COLOR000066; STICKLINE(CROSS(买线,多空*0.991),O,C,1.9,0),COLOR000088; STICKLINE(CROSS(买线,多空*0.991),O,C,1.6,0),COLOR0000AA; STICKLINE(CROSS(买线,多空*0.991),O,C,1.2,0),COLOR0000BB; STICKLINE(CROSS(买线,多空*0.991),O,C,0.6,0),COLOR0000CC; STICKLINE(CROSS(买线,多空*0.991),O,C,0.1,0),COLOR0000DD; {线上阴K线} STICKLINE(CROSS(多空*1.009,买线),O,C,2.1,0),COLOR006600; STICKLINE(CROSS(多空*1.009,买线),O,C,1.9,0),COLOR008800; STICKLINE(CROSS(多空*1.009,买线),O,C,1.6,0),COLOR00AA00; STICKLINE(CROSS(多空*1.009,买线),O,C,1.2,0),COLOR00BB00; STICKLINE(CROSS(多空*1.009,买线),O,C,0.6,0),COLOR00CC00; STICKLINE(CROSS(多空*1.009,买线),O,C,0.1,0),COLOR00DD00; {线下阳K线} STICKLINE(CROSS(买线,多空*0.999),O,C,2.1,0),COLOR000066; STICKLINE(CROSS(买线,多空*0.999),O,C,1.9,0),COLOR000088; STICKLINE(CROSS(买线,多空*0.999),O,C,1.6,0),COLOR0000AA; STICKLINE(CROSS(买线,多空*0.999),O,C,1.2,0),COLOR0000BB; STICKLINE(CROSS(买线,多空*0.999),O,C,0.6,0),COLOR0000CC; STICKLINE(CROSS(买线,多空*0.999),O,C,0.1,0),COLOR0000DD; {线下阴K线} STICKLINE(CROSS(多空*1.001,买线),O,C,2.1,0),COLOR006600; STICKLINE(CROSS(多空*1.001,买线),O,C,1.9,0),COLOR008800; STICKLINE(CROSS(多空*1.001,买线),O,C,1.6,0),COLOR00AA00; STICKLINE(CROSS(多空*1.001,买线),O,C,1.2,0),COLOR00BB00; STICKLINE(CROSS(多空*1.001,买线),O,C,0.6,0),COLOR00CC00; STICKLINE(CROSS(多空*1.001,买线),O,C,0.1,0),COLOR00DD00; {主图标释} DRAWTEXT_FIX(1,0.6,0.02,0,'【名称】'),COLORGREEN; DRAWTEXT_FIX(1,0.675,0.02,0,STKNAME),COLORYELLOW; DRAWTEXT_FIX(1,0.6,0.07,0,'【代码】'),COLORGREEN; DRAWTEXT_FIX(1,0.675,0.07,0,CODE),COLOR0080FF; DRAWTEXT_FIX(1,0.6,0.12,0,'【现价】'),COLORGREEN; DRAWNUMBER_FIX(1,0.675,0.12,0,现价),COLORCYAN; DRAWTEXT_FIX(1,0.6,0.17,0,'【均价】'),COLORGREEN; DRAWNUMBER_FIX(1,0.675,0.17,0,DYNAINFO(11)),COLORWHITE; {多空转换点} FX1:=100*(HHV(H,25)-C)/(HHV(H,25)-LLV(L,25));FX2:=100*(HHV(H,60)-C)/(HHV(H,60)-LLV(L,60)); VARBT:=EMA((C-LLV(L,15))/(HHV(H,25)-LLV(L,15))*4,5);DY:=CROSS(90,FX1) AND CROSS(90,FX2) AND COUNT(ABS(FX1-FX2)/FX2<0.15,1)=1,NODRAW; {紫色空方关键点} STICKLINE(CROSS(3,VARBT),O,(O+C)/2,2.1,0),COLOR5E005E; STICKLINE(CROSS(3,VARBT),O,(O+C)/2,1.9,0),COLOR750075; STICKLINE(CROSS(3,VARBT),O,(O+C)/2,1.6,0),COLOR930093; STICKLINE(CROSS(3,VARBT),O,(O+C)/2,1.2,0),COLORAE00AE; STICKLINE(CROSS(3,VARBT),O,(O+C)/2,0.6,0),COLORD200D2; STICKLINE(CROSS(3,VARBT),O,(O+C)/2,0.1,0),COLORE800E8; {红色多方关键点} STICKLINE(DY,O,(O+C)/2,1.9,0),COLOR000055; STICKLINE(DY,O,(O+C)/2,1.6,0),COLOR000077; STICKLINE(DY,O,(O+C)/2,1.3,0),COLOR000099; STICKLINE(DY,O,(O+C)/2,0.9,0),COLOR0000BB; STICKLINE(DY,O,(O+C)/2,0.6,0),COLOR0000DD; STICKLINE(DY,O,(O+C)/2,0.1,0),COLOR0000FF; {波段顶底预警} N2:=7;LC:=REF(C,1);RSI:=SMA(MAX(C-LC,0),N2,1)/SMA(ABS(C-LC),N2,1)*100; {青顶预警} STICKLINE((REF(RSI,1)>=80 AND RSI<80),H,(O+H)/2,2.1,0),COLOR999900; STICKLINE((REF(RSI,1)>=80 AND RSI<80),H,(O+H)/2,1.6,0),COLORAAAA00; STICKLINE((REF(RSI,1)>=80 AND RSI<80),H,(O+H)/2,1.2,0),COLORBBBB00; STICKLINE((REF(RSI,1)>=80 AND RSI<80),H,(O+H)/2,0.8,0),COLORCCCC00; STICKLINE((REF(RSI,1)>=80 AND RSI<80),H,(O+H)/2,0.2,0),COLORDDDD00; {橘底预警} STICKLINE((REF(RSI,1)<=20 AND RSI>20),L,(O+L)/2,1.9,0),COLOR002288; STICKLINE((REF(RSI,1)<=20 AND RSI>20),L,(O+L)/2,1.6,0),COLOR0033AA; STICKLINE((REF(RSI,1)<=20 AND RSI>20),L,(O+L)/2,1.2,0),COLOR0044CC; STICKLINE((REF(RSI,1)<=20 AND RSI>20),L,(O+L)/2,0.8,0),COLOR0055EE; STICKLINE((REF(RSI,1)<=20 AND RSI>20),L,(O+L)/2,0.2,0),COLOR0088FF; {顶底K线分型} ZXX:=(H+L+O+C*3)/6;NX:=(3*C+L+O+H)/6; ZNX:=(20*NX+19*REF(NX,1)+18*REF(NX,2)+17*REF(NX,3)+16*REF(NX,4) +15*REF(NX,5)+14*REF(NX,6)+13*REF(NX,7)+12*REF(NX,8)+11*REF(NX,9) +10*REF(NX,10)+9*REF(NX,11)+8*REF(NX,12)+7*REF(NX,13)+6*REF(NX,14) +5*REF(NX,15)+4*REF(NX,16)+3*REF(NX,17)+2*REF(NX,18)+REF(NX,20))/210; NXX:=MA(ZNX,6); GD:=H>REF(H,1) AND REF(H,1)<REF(H,2) AND L>REF(L,1) AND REF(L,1)<REF(L,2); GT:=H<REF(H,1) AND REF(H,1)>REF(H,2) AND L<REF(L,1) AND REF(L,1)>REF(L,2); BH1:=REF(H,1)>=REF(H,2) AND REF(L,1)<=REF(L,2); BH2:=REF(H,1)<=REF(H,2) AND REF(L,1)>=REF(L,2); BD1:=H>REF(H,2) AND REF(H,2)<REF(H,3) AND L>REF(L,1) AND REF(L,1)<REF(L,3); BD2:=H>REF(H,1) AND REF(H,1)<REF(H,3) AND L>REF(L,2) AND REF(L,2)<REF(L,3); BT1:=H<REF(H,1) AND REF(H,1)>REF(H,3) AND L<REF(L,2) AND REF(L,2)>REF(L,3); BT2:=H<REF(H,2) AND REF(H,2)>REF(H,3) AND L<REF(L,1) AND REF(L,1)>REF(L,3); FD:=IF(BH1,BD1,IF(BH2,BD2,GD));FT:=IF(BH1,BT1,IF(BH2,BT2,GT)); DFX:=IF(BARSLAST(CROSS(NXX,ZXX))>3,FILTER(BACKSET(FILTER(FD AND ZXX<NXX,3),2),1),0); TFX:=IF(BARSLAST(CROSS(ZXX,NXX))>3,FILTER(BACKSET(FILTER(FT AND ZXX>NXX,3),2),1),0); {深绿顶分型} STICKLINE(TFX,H,L,0,0),COLOR668800; STICKLINE(TFX,C,O,2.1,10),COLOR113300; STICKLINE(TFX,C,O,1.9,10),COLOR224400; STICKLINE(TFX,C,O,1.6,10),COLOR335500; STICKLINE(TFX,C,O,1.2,10),COLOR446600; STICKLINE(TFX,C,O,0.6,10),COLOR557700; STICKLINE(TFX,C,O,0.1,0),COLOR668800; {暗黄底分型} STICKLINE(DFX,H,L,0,0),COLOR4499CC; STICKLINE(DFX,O,C,1.9,10),COLOR225588; STICKLINE(DFX,O,C,1.6,10),COLOR226699; STICKLINE(DFX,O,C,1.2,10),COLOR3377AA; STICKLINE(DFX,O,C,0.6,10),COLOR3388BB; STICKLINE(DFX,O,C,0.1,0),COLOR4499CC; {压力支撑位} VAR1111:=BACKSET(REF(H,2)=HHV(H,5),3); VAR2222:=CROSS(VAR1111,0.9); VAR3333:=BACKSET(REF(L,2)=LLV(L,5),3); VAR4444:=CROSS(VAR3333,0.9); 波段顶:= REF(H,BARSLAST(VAR2222)); STICKLINE(C,REF(H,BARSLAST(VAR2222)),REF(H,BARSLAST(VAR2222)),0.5,1),COLORGREEN; 波段底:= REF(L,BARSLAST(VAR4444)); STICKLINE(C,REF(L,BARSLAST(VAR4444)),REF(L,BARSLAST(VAR4444)),0.5,1),COLORRED;





未来函数检测结果如下:
该公式包含未来函数:BACKSET
该公式包含未来函数:DYNAINFO

解密、定制、编写股票指标请联系QQ或微信同号:88652583
相关股票指标公式

{背景色} 填充背景(O>0,RGB(33,47,58),RGB(0,0,0),0,'02',0)
输出{现价游标} 现价:CONST(C),画青色,DOTLINE
{持股线} 持币赋值:C的5日简单移动平均
输出持股:IF(持币>=1日前的持币,持币,DRAWNULL),画红色
{标缺口} LL赋值:1日前的L
HH赋值:1日前的H
上跳赋值:L>HH
下跳赋值:H STICKLINE(L>1日前的H,L,1日前的H,2.1,-1),画红色
STICKLINE(1日前的L>H,1日前的L,H,1.8,-1),画绿色
{多空波段分界线} 买线赋值:C的2日指数移动平均
输出多空:EMA(SLOPE(C,30)*20+C,51),画白色
输出涨家数:INDEXADV,NODRAW,COLORLIMAGENTA
输出跌家数:INDEXDEC,NODRAW,画绿色
当满足条件买线>=多空时,在L和H之间画柱状线
当满足条件买线>=多空时,在C和O之间画柱状线
当满足条件买线<多空时,在L和H之间画柱状线
当满足条件买线<多空时,在C和O之间画柱状线
{线上阳K线} STICKLINE(买线上穿多空*0.991,O,C,2.1,0),COLOR000066
STICKLINE(买线上穿多空*0.991,O,C,1.9,0),COLOR000088
STICKLINE(买线上穿多空*0.991,O,C,1.6,0),COLOR0000AA
STICKLINE(买线上穿多空*0.991,O,C,1.2,0),COLOR0000BB
STICKLINE(买线上穿多空*0.991,O,C,0.6,0),COLOR0000CC
STICKLINE(买线上穿多空*0.991,O,C,0.1,0),COLOR0000DD
{线上阴K线} STICKLINE(多空*1.009上穿买线,O,C,2.1,0),COLOR006600
STICKLINE(多空*1.009上穿买线,O,C,1.9,0),COLOR008800
STICKLINE(多空*1.009上穿买线,O,C,1.6,0),COLOR00AA00
STICKLINE(多空*1.009上穿买线,O,C,1.2,0),COLOR00BB00
STICKLINE(多空*1.009上穿买线,O,C,0.6,0),COLOR00CC00
STICKLINE(多空*1.009上穿买线,O,C,0.1,0),COLOR00DD00
{线下阳K线} STICKLINE(买线上穿多空*0.999,O,C,2.1,0),COLOR000066
STICKLINE(买线上穿多空*0.999,O,C,1.9,0),COLOR000088
STICKLINE(买线上穿多空*0.999,O,C,1.6,0),COLOR0000AA
STICKLINE(买线上穿多空*0.999,O,C,1.2,0),COLOR0000BB
STICKLINE(买线上穿多空*0.999,O,C,0.6,0),COLOR0000CC
STICKLINE(买线上穿多空*0.999,O,C,0.1,0),COLOR0000DD
{线下阴K线} STICKLINE(多空*1.001上穿买线,O,C,2.1,0),COLOR006600
STICKLINE(多空*1.001上穿买线,O,C,1.9,0),COLOR008800
STICKLINE(多空*1.001上穿买线,O,C,1.6,0),COLOR00AA00
STICKLINE(多空*1.001上穿买线,O,C,1.2,0),COLOR00BB00
STICKLINE(多空*1.001上穿买线,O,C,0.6,0),COLOR00CC00
STICKLINE(多空*1.001上穿买线,O,C,0.1,0),COLOR00DD00
当满足条件1时,在横轴0.6纵轴0.02位置书写文字
当满足条件1时,在横轴0.675纵轴0.02位置书写文字
当满足条件1时,在横轴0.6纵轴0.07位置书写文字
当满足条件1时,在横轴0.675纵轴0.07位置书写文字
当满足条件1时,在横轴0.6纵轴0.12位置书写文字
当满足条件1时,在横轴0.675纵轴0.12位置书写数字
当满足条件1时,在横轴0.6纵轴0.17位置书写文字
DRAWNUMBER_FIX(1,0.675,0.17,0,DYNAINFO(11)),画白色
{多空转换点} FX1:=100*(25日内H最高值-C)/(25日内H最高值-25日内L最低值)
FX2赋值:100*(60日内H最高值-C)/(60日内H最高值-60日内L最低值)
VARBT赋值:EMA((C-15日内L最低值)/(25日内H最高值-15日内L最低值)*4,5)
DY赋值:90上穿FX1 AND 90上穿FX2 AND COUNT(FX1-FX2的绝对值/FX2<0.15,1)=1,NODRAW
{紫色空方关键点} STICKLINE(3上穿VARBT,O,(O+C)/2,2.1,0),COLOR5E005E
STICKLINE(3上穿VARBT,O,(O+C)/2,1.9,0),COLOR750075
STICKLINE(3上穿VARBT,O,(O+C)/2,1.6,0),COLOR930093
STICKLINE(3上穿VARBT,O,(O+C)/2,1.2,0),COLORAE00AE
STICKLINE(3上穿VARBT,O,(O+C)/2,0.6,0),COLORD200D2
STICKLINE(3上穿VARBT,O,(O+C)/2,0.1,0),COLORE800E8
{红色多方关键点} STICKLINE(DY,O,(O+C)/2,1.9,0),COLOR000055
STICKLINE(DY,O,(O+C)/2,1.6,0),COLOR000077
STICKLINE(DY,O,(O+C)/2,1.3,0),COLOR000099
STICKLINE(DY,O,(O+C)/2,0.9,0),COLOR0000BB
STICKLINE(DY,O,(O+C)/2,0.6,0),COLOR0000DD
STICKLINE(DY,O,(O+C)/2,0.1,0),COLOR0000FF
{波段顶底预警} N2赋值:7
LC赋值:1日前的C
RSI赋值:SMA(C-LC和0较大值,N2,1)/SMA(C-LC的绝对值,N2,1)*100
{青顶预警} STICKLINE((1日前的RSI>=80 AND RSI<80),H,(O+H)/2,2.1,0),COLOR999900
STICKLINE((1日前的RSI>=80 AND RSI<80),H,(O+H)/2,1.6,0),COLORAAAA00
STICKLINE((1日前的RSI>=80 AND RSI<80),H,(O+H)/2,1.2,0),COLORBBBB00
STICKLINE((1日前的RSI>=80 AND RSI<80),H,(O+H)/2,0.8,0),COLORCCCC00
STICKLINE((1日前的RSI>=80 AND RSI<80),H,(O+H)/2,0.2,0),COLORDDDD00
{橘底预警} STICKLINE((1日前的RSI<=20 AND RSI>20),L,(O+L)/2,1.9,0),COLOR002288
STICKLINE((1日前的RSI<=20 AND RSI>20),L,(O+L)/2,1.6,0),COLOR0033AA
STICKLINE((1日前的RSI<=20 AND RSI>20),L,(O+L)/2,1.2,0),COLOR0044CC
STICKLINE((1日前的RSI<=20 AND RSI>20),L,(O+L)/2,0.8,0),COLOR0055EE
STICKLINE((1日前的RSI<=20 AND RSI>20),L,(O+L)/2,0.2,0),COLOR0088FF
{顶底K线分型} ZXX赋值:(H+L+O+C*3)/6
NX赋值:(3*C+L+O+H)/6
ZNX赋值:(20*NX+19*1日前的NX+18*2日前的NX+17*3日前的NX+16*4日前的NX +15*5日前的NX+14*6日前的NX+13*7日前的NX+12*8日前的NX+11*9日前的NX +10*10日前的NX+9*11日前的NX+8*12日前的NX+7*13日前的NX+6*14日前的NX +5*15日前的NX+4*16日前的NX+3*17日前的NX+2*18日前的NX+20日前的NX)/210
NXX:=ZNX的6日简单移动平均
GD赋值:H>1日前的H AND 1日前的H<2日前的H AND L>1日前的L AND 1日前的L<2日前的L
GT赋值:H<1日前的H AND 1日前的H>2日前的H AND L<1日前的L AND 1日前的L>2日前的L
BH1赋值:1日前的H>=2日前的H AND 1日前的L<=2日前的L
BH2赋值:1日前的H<=2日前的H AND 1日前的L>=2日前的L
BD1赋值:H>2日前的H AND 2日前的H<3日前的H AND L>1日前的L AND 1日前的L<3日前的L
BD2赋值:H>1日前的H AND 1日前的H<3日前的H AND L>2日前的L AND 2日前的L<3日前的L
BT1赋值:H<1日前的H AND 1日前的H>3日前的H AND L<2日前的L AND 2日前的L>3日前的L
BT2赋值:H<2日前的H AND 2日前的H>3日前的H AND L<1日前的L AND 1日前的L>3日前的L
FD赋值:IF(BH1,BD1,IF(BH2,BD2,GD))
FT赋值:IF(BH1,BT1,IF(BH2,BT2,GT))
DFX赋值:IF(上次NXX上穿ZXX距今天数>3,FILTER(BACKSET(FILTER(FD AND ZXX TFX赋值:IF(上次ZXX上穿NXX距今天数>3,FILTER(BACKSET(FILTER(FT AND ZXX>NXX,3),2),1),0)
当满足条件TFX时,在H和L之间画柱状线
当满足条件TFX时,在C和O之间画柱状线
当满足条件TFX时,在C和O之间画柱状线
当满足条件TFX时,在C和O之间画柱状线
当满足条件TFX时,在C和O之间画柱状线
当满足条件TFX时,在C和O之间画柱状线
当满足条件TFX时,在C和O之间画柱状线
当满足条件DFX时,在H和L之间画柱状线
当满足条件DFX时,在O和C之间画柱状线
当满足条件DFX时,在O和C之间画柱状线
当满足条件DFX时,在O和C之间画柱状线
当满足条件DFX时,在O和C之间画柱状线
当满足条件DFX时,在O和C之间画柱状线
{压力支撑位} VAR1111赋值:BACKSET(2日前的H=5日内H最高值,3)
VAR2222赋值:VAR1111上穿0.9
VAR3333赋值:BACKSET(2日前的L=5日内L最低值,3)
VAR4444赋值:VAR3333上穿0.9
波段顶赋值: REF(H,上次VAR2222距今天数)
STICKLINE(C,REF(H,上次VAR2222距今天数),REF(H,上次VAR2222距今天数),0.5,1),画绿色
波段底赋值: REF(L,上次VAR4444距今天数)
STICKLINE(C,REF(L,上次VAR4444距今天数),REF(L,上次VAR4444距今天数),0.5,1),画红色



联系我们  |  指标公式网  |  指标网   |  指标公式  |   加入收藏   |  设为主页

@2005-2023 浙ICP备2024071487号-2 指标公式网别名指标网均来源互联网收集整理,如不慎侵犯了你的权益,请联系我们告知,我们将做删除处理
免责声明:指标公式网所有指标公式及文章由网络收集,不保障实时性和真实性, 仅供学习研究并不构成投资建议,请勿以此为依据进行股票交易,由此引起的投资亏损与本站无关。
QQ:88652583 微信 88652583
sitemap站点地图