通达信超级OBV指标公式
MOBV:=OBV-MA(OBV,30);
W1:STICKLINE(MOBV>0,MOBV,0,3,1),COLORRED;
W2:STICKLINE(MOBV<0,MOBV,0,3,1),COLORCYAN;
VA1:=HHVBARS(MOBV,BARSLAST(MOBV<0)+1);
VA2:=CROSS(BACKSET(CROSS(0,MOBV),REF(VA1,1)+2),0.5);
QG:=CROSS(BACKSET(CROSS(0,MOBV) OR (ISLASTBAR AND MOBV>0),REF(VA1,1)+2),0.5);
前高:DRAWLINE(VA2,MOBV,REF(VA2,1),REF(MOBV,1),1),COLORMAGENTA;
VA3:=LLVBARS(MOBV,BARSLAST(MOBV>0)+1);
VA4:=CROSS(BACKSET(CROSS(MOBV,0),REF(VA3,1)+2),0.5);
BD:=BARSLAST(FILTERX(CROSS(0,MOBV),BARSCOUNT(CLOSE)));
前低:DRAWLINE(VA4,MOBV,REF(VA4,1),REF(MOBV,1),1);
BDTJ:=IF(MOBV<0,FILTERX(MOBV=LLV(MOBV,BARSLAST(MOBV>0)),BARSCOUNT(CLOSE)),DRAWNULL);
TSBDTJ:=BARSLAST(BDTJ);
BDZH:=FILTERX(MOBV<CONST(LLV(MOBV,BD+1)),BARSCOUNT(CLOSE));
BDTS:=BARSLAST(BDZH);
本低:IF(BD+1>=1,CONST(LLV(MOBV,BD+1)),DRAWNULL);
BDCL:=CROSS(COUNT(CROSS(MOBV>本低/2 AND MOBV<0,0.5),TSBDTJ)=1,0.5) AND TSBDTJ>=0;
终点:=IF(ISLASTBAR AND MOBV>0 AND MOBV=HHV(MOBV,BARSLAST(MOBV<0)),1,IF(FILTERX(QG,BARSCOUNT(CLOSE)),2,DRAWNULL));
UU:=终点=1 OR 终点=2 AND MOBV>0;
ZZ:=FILTERX(UU,BARSCOUNT(CLOSE));
本高:DRAWLINE(ZZ,MOBV,REF(ZZ,1),REF(MOBV,1),1),COLORWHITE;
横线:=CONST(REF(MOBV,BARSLAST(ZZ)));
WW:=MOBV>横线;
起始点:=FILTERX(REFX(BARSLAST(WW),1)=1,BARSCOUNT(CLOSE));
天数:=BARSLAST(起始点);
上横线:=DRAWLINE(起始点,横线,ZZ,横线,0);
下横线:=DRAWLINE(BDZH,CONST(LLV(MOBV,BD+1)),BDTJ=1,MOBV,0);
TDXSTEP1219:DRAWNUMBER(BDTJ,CONST(LLV(MOBV,BD+1))*0.9,BDTS);
TDXSTEP1220:DRAWNUMBER(ZZ,上横线*1.1,天数);
TJ:=IF(起始点,BARSNEXT(ZZ),DRAWNULL);
红柱数量:=IF(天数>0 AND 天数<=REF(TJ,天数),SUM(MOBV>0,天数),DRAWNULL);
横线起始价:=REF(CLOSE,天数);
空间评估:=(横线起始价-CLOSE)/CLOSE*100;
TT:=BARSLAST(ZZ);
WQG:=CROSS(COUNT(CROSS(MOBV<本高/2 AND MOBV>0,0.5),ZZ)=1,0.5) AND ZZ>=0;
TDXSTEP1221:STICKLINE(MOBV>前高 AND 本高>前高 AND BARSLAST(CROSS(MOBV<本高/2,0.5))>0 AND MOBV>(前高+本高)/2,MOBV,前高,1,0),COLORYELLOW;
前高本高二分位:IF(MOBV>0 AND 本高!=前高,DRAWLINE(WQG,(前高+本高)/2,REF(WQG,1),REF((前高+本高)/2,1),1),DRAWNULL),DOTLINE,COLORLIBLUE;
AA:=STRCAT(STRCAT(STRCAT(53,54),55),CON2STR(IF(空间评估,空间评估,DRAWNULL),2));
TDXSTEP1222:STICKLINE(MOBV>前高,MOBV,前高,1,0),COLORYELLOW;
TDXSTEP1223:STICKLINE(WQG,MOBV,0,1,0),COLORGREEN;
TDXSTEP1224:STICKLINE(MOBV<0 AND MOBV<前低 AND 前低<0,MOBV,前低,1,0),COLORBLUE;
B1:=IF(CROSS(MOBV<0,0.5),BARSNEXT(BDTJ),DRAWNULL);
TSB1:=BARSLAST(MOBV>0)-1;
TDXSTEP1225:STICKLINE(BARSLAST(BDCL)>=0 AND MOBV<前低 AND MOBV<0,MOBV,前低,1,0),COLORGREEN;
TDXSTEP1226:STICKLINE(BDCL,MOBV,0,1,0),COLORWHITE;
TDXSTEP1227:STICKLINE(MOBV>前高 AND 本高>前高 AND BARSLAST(WQG)>0,MOBV,前高,1,0),COLORRED;
TDXSTEP1228:DRAWTEXT(VA2 AND VA2!=UU,MOBV/10*9,56);
TDXSTEP1229:DRAWTEXT(VA2 AND VA2!=UU,MOBV/10,57);
TDXSTEP1230:DRAWTEXT(ZZ,MOBV/10*7,58),COLORBLUE;
TDXSTEP1231:DRAWTEXT(ZZ,MOBV/10,57),COLORBLUE;
TDXSTEP1232:DRAWTEXT(BDTJ,MOBV/10*9,59),COLORRED;
TDXSTEP1233:DRAWTEXT(BDTJ,MOBV/10,58),COLORRED;
TDXSTEP1234:IF(BARSLAST(BDCL)>=0,本低/2,DRAWNULL),DOTLINE,COLORRED;
DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIFF,9);
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
J1:=DIFF;
J2:=DEA;
J3:=K;
J4:=D;
VL:=REF(LOW,1);
VH:=REF(HIGH,1);
VAR1:=SMA(ABS(HIGH-VH),13,1)/SMA(MAX(HIGH-VH,0),13,1)*100;
VAR2:=SMA(ABS(LOW-VL),13,1)/SMA(MAX(LOW-VL,0),13,1)*100;
VAR3:=REF(CLOSE,1);
VAR4:=MA(VAR2,13);
VAR5:=LLV(LOW,34);
VAR6:=SMA(MAX(CLOSE-VAR3,0),6,1)/SMA(ABS(CLOSE-VAR3),6,1)*100;
VAR7:=CROSS(93,VAR6);
VAR8:=EMA(IF(LOW<=VAR5,VAR4,0),3);
VAR9:=HIGH>LLV(LOW,0)*7;
VAR10:=SMA(SMA((CLOSE-LLV(LOW,54))/(HHV(HIGH,54)-LLV(LOW,54))*100,7,1),5,1);
VAR11:=SMA((CLOSE-LLV(LOW,54))/(HHV(HIGH,54)-LLV(LOW,54))*100,7,1)*16.18-VAR10*10.9;
T:=FILTER(IF(VAR11<=VAR10 AND VAR8>REF(VAR8,1),VAR8*8,0),20);
洗盘结束:IF(VAR11<=VAR10 AND VAR8>REF(VAR8,1),100000,0),COLORMAGENTA,LINETHICK2;
T0:FILTER(IF(CROSS(J4,J3) AND SUM(J1>REF(J1,1),3)>3,CROSS(J4,J3) AND CROSS(J2,J1),0),13),STICK,COLOR5E8262,LINETHICK3;
T1:FILTER(CROSS(J1,J2) AND VOL>REF(SUM(VOL,5),1),3),STICK,COLORYELLOW,LINETHICK3;
T2:FILTER(VAR7 AND CLOSE/(REF(CLOSE,1)-1)*100!=5 AND VAR9 AND VOL>REF(SUM(VOL,3),1),5),STICK,COLORCYAN,LINETHICK3;
T3:FILTER(VAR9 AND CROSS(J4,J3) AND CLOSE/(REF(CLOSE,1)-1)*100!=5,22),STICK,COLORGREEN,LINETHICK3;
TDXSTEP1235:DRAWTEXT(T0,T0,23),COLOR5E8262;
TDXSTEP1236:DRAWTEXT(T,120000,24),COLORMAGENTA;
TDXSTEP1237:DRAWTEXT(T1,T1*0.9,25),COLORYELLOW;
TDXSTEP1238:DRAWTEXT(T2,T2*0.9,26),COLORCYAN;
TDXSTEP1239:DRAWTEXT(T3,T3*0.9,27),COLORGREEN;
{-----------------------------------}
未来函数检测结果如下:
该公式包含未来函数:BACKSET
该公式包含未来函数:BARSNEXT
该公式包含未来函数:REFX
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
MOBV赋值:OBV-OBV的30日简单移动平均
当满足条件MOBV>0时,在MOBV和0之间画柱状线
当满足条件MOBV<0时,在MOBV和0之间画柱状线
VA1赋值:HHVBARS(MOBV,上次MOBV<0距今天数+1)
VA2赋值:CROSS(BACKSET(CROSS(0,MOBV),1日前的VA1+2),0.5)
QG赋值:CROSS(BACKSET(CROSS(0,MOBV) OR (ISLASTBAR AND MOBV>0),1日前的VA1+2),0.5)
输出
前高:DRAWLINE(VA2,MOBV,1日前的VA2,1日前的MOBV,1),画洋红色
VA3赋值:LLVBARS(MOBV,上次MOBV>0距今天数+1)
VA4赋值:CROSS(BACKSET(CROSS(MOBV,0),1日前的VA3+2),0.5)
BD赋值:上次FILTERX(0上穿MOBV,收盘价的有效数据周期数距今天数)
输出
前低:DRAWLINE(VA4,MOBV,1日前的VA4,1日前的MOBV,1)
BDTJ:=IF(MOBV<0,FILTERX(MOBV=LLV(MOBV,上次MOBV>0距今天数),收盘价的有效数据周期数),DRAWNULL)
TSBDTJ赋值:上次BDTJ距今天数
BDZH:=FILTERX(MOBV
BDTS:=上次BDZH距今天数
输出
本低:IF(BD+1>=1,CONST(BD+1日内MOBV最低值),DRAWNULL)
BDCL:=CROSS(COUNT(CROSS(MOBV>本低/2 AND MOBV<0,0.5),TSBDTJ)=1,0.5) AND TSBDTJ>=0
终点赋值:IF(ISLASTBAR AND MOBV>0 AND MOBV=HHV(MOBV,上次MOBV<0距今天数),1,IF(FILTERX(QG,收盘价的有效数据周期数),2,DRAWNULL))
UU赋值:终点=1 OR 终点=2 AND MOBV>0
ZZ赋值:FILTERX(UU,收盘价的有效数据周期数)
输出
本高:DRAWLINE(ZZ,MOBV,1日前的ZZ,1日前的MOBV,1),画白色
横线赋值:CONST(REF(MOBV,上次ZZ距今天数))
WW赋值:MOBV>横线
起始点赋值:FILTERX(REFX(上次WW距今天数,1)=1,收盘价的有效数据周期数)
天数赋值:上次起始点距今天数
上横线赋值:DRAWLINE(起始点,横线,ZZ,横线,0)
下横线赋值:DRAWLINE(BDZH,CONST(BD+1日内MOBV最低值),BDTJ=1,MOBV,0)
输出
TDXSTEP1219:DRAWNUMBER(BDTJ,CONST(BD+1日内MOBV最低值)*0.9,BDTS)
输出
TDXSTEP1220:DRAWNUMBER(ZZ,上横线*1.1,天数)
TJ赋值:IF(起始点,BARSNEXT(ZZ),DRAWNULL)
红柱数量赋值:IF(天数>0 AND 天数<=天数日前的TJ,天数的MOBV>0日累和,DRAWNULL)
横线起始价:=天数日前的收盘价
空间评估赋值:(横线起始价-收盘价)/收盘价*100
TT赋值:上次ZZ距今天数
WQG赋值:CROSS(COUNT(CROSS(MOBV<本高/2 AND MOBV>0,0.5),ZZ)=1,0.5) AND ZZ>=0
输出
TDXSTEP1221:STICKLINE(MOBV>前高 AND 本高>前高 AND 上次MOBV<本高/2上穿0.5距今天数>0 AND MOBV>(前高+本高)/2,MOBV,前高,1,0),画黄色
前高本高二分位:IF(MOBV>0 AND 本高!=前高,DRAWLINE(WQG,(前高+本高)/2,1日前的WQG,REF((前高+本高)/2,1),1),DRAWNULL),DOTLINE,COLORLIBLUE
如果空间评估返回空间评估否则返回DRAWNULL
当满足条件MOBV>前高时,在MOBV和前高之间画柱状线
当满足条件WQG时,在MOBV和0之间画柱状线
当满足条件MOBV<0 AND MOBV<前低 AND 前低<0时,在MOBV和前低之间画柱状线
B1赋值:IF(MOBV<0上穿0.5,BARSNEXT(BDTJ),DRAWNULL)
TSB1赋值:上次MOBV>0距今天数-1
输出
TDXSTEP1225:STICKLINE(上次BDCL距今天数>=0 AND MOBV<前低 AND MOBV<0,MOBV,前低,1,0),画绿色
当满足条件BDCL时,在MOBV和0之间画柱状线
输出
TDXSTEP1227:STICKLINE(MOBV>前高 AND 本高>前高 AND 上次WQG距今天数>0,MOBV,前高,1,0),画红色
当满足条件VA2 AND VA2!=UU时,在MOBV/10*9和56位置书写文字
当满足条件VA2 AND VA2!=UU时,在MOBV/10和57位置书写文字
当满足条件ZZ时,在MOBV/10*7和58位置书写文字
当满足条件ZZ时,在MOBV/10和57位置书写文字
当满足条件BDTJ时,在MOBV/10*9和59位置书写文字
当满足条件BDTJ时,在MOBV/10和58位置书写文字
输出
TDXSTEP1234:IF(上次BDCL距今天数>=0,本低/2,DRAWNULL),DOTLINE,画红色
DIFF赋值:收盘价的12日指数移动平均-收盘价的26日指数移动平均
DEA赋值:DIFF的9日指数移动平均
RSV赋值:(收盘价-9日内最低价最低值)/(9日内最高价最高值-9日内最低价最低值)*100
RSV的3日[1日权重]移动平均
K的3日[1日权重]移动平均
J1赋值:DIFF
J2赋值:DEA
J3赋值:K
J4赋值:D
VL赋值:1日前的最低价
VH赋值:1日前的最高价
VAR1赋值:SMA(最高价-VH的绝对值,13,1)/SMA(最高价-VH和0较大值,13,1)*100
VAR2赋值:SMA(最低价-VL的绝对值,13,1)/SMA(最低价-VL和0较大值,13,1)*100
VAR3赋值:1日前的收盘价
VAR4赋值:VAR2的13日简单移动平均
VAR5赋值:34日内最低价最低值
VAR6赋值:SMA(收盘价-VAR3和0较大值,6,1)/SMA(收盘价-VAR3的绝对值,6,1)*100
VAR7赋值:93上穿VAR6
如果最低价<=VAR5返回VAR4否则返回0
VAR9赋值:最高价>0日内最低价最低值*7
VAR10:=SMA(SMA((收盘价-54日内最低价最低值)/(54日内最高价最高值-54日内最低价最低值)*100,7,1),5,1)
VAR11:=SMA((收盘价-54日内最低价最低值)/(54日内最高价最高值-54日内最低价最低值)*100,7,1)*16.18-VAR10*10.9
T赋值:FILTER(IF(VAR11<=VAR10 AND VAR8>1日前的VAR8,VAR8*8,0),20)
输出
洗盘结束:IF(VAR11<=VAR10 AND VAR8>1日前的VAR8,100000,0),画洋红色, 线宽为2
T0:FILTER(IF(J4上穿J3 AND 3的J1>1日前的J1日累和>3,J4上穿J3 AND J2上穿J1,0),13),STICK,COLOR5E8262, 线宽为3
T1:FILTER(J1上穿J2 AND 成交量>REF(5的成交量日累和,1),3),STICK,画黄色, 线宽为3
T2:FILTER(VAR7 AND 收盘价/(1日前的收盘价-1)*100!=5 AND VAR9 AND 成交量>REF(3的成交量日累和,1),5),STICK,画青色, 线宽为3
T3:FILTER(VAR9 AND J4上穿J3 AND 收盘价/(1日前的收盘价-1)*100!=5,22),STICK,画绿色, 线宽为3
当满足条件T0时,在T0和23位置书写文字
当满足条件T时,在120000和24位置书写文字
当满足条件T1时,在T1*0.9和25位置书写文字
当满足条件T2时,在T2*0.9和26位置书写文字
当满足条件T3时,在T3*0.9和27位置书写文字
{-----------------------------------}