通达信综合背离2(指标副图贴图)

 

本公式带有九转序列,macd背离,kdj背离,macd面积 ,出现红色箭头表示cci值小于-150,且kdj的j值小于20.其他的自己研究

 

{MACD背离}
DIFF:EMA(CLOSE,12) - EMA(CLOSE,26);
 DEA:EMA(DIFF,9);
 MACD:2*(DIFF-DEA), COLORSTICK,DRAWABOVE;
 MACD金叉:=BARSLAST(REF(CROSS(DIFF,DEA),1));
 MACD死叉:=BARSLAST(REF(CROSS(DEA,DIFF),1));
 MACD上次金叉:=SUMBARS(REF(CROSS(DIFF,DEA),1),2);
 MACD上次死叉:=SUMBARS(REF(CROSS(DEA,DIFF),1),2);
 {MACD底背离}
MACD次低点:=LLV(DIFF,MACD金叉);
MACD最低点:=LLV(DIFF,MACD上次死叉);
MACD底背离:=REF(CLOSE,MACD金叉+1)>CLOSE AND MACD次低点>MACD最低点 AND CROSS(DIFF,DEA);
 DRAWLINE(MACD金叉=0,DEA,MACD底背离,DEA,0),COLORRED,LINETHICK2;
 {MACD顶背离}
MACD次高点:=HHV(DIFF,MACD金叉);
MACD最高点:=HHV(DIFF,MACD上次金叉);
MACD顶背离:=REF(CLOSE,MACD死叉+1)<CLOSE AND MACD次高点<MACD最高点 AND CROSS(DEA,DIFF);
 DRAWLINE(MACD死叉=0,DEA,MACD顶背离,DEA,0),COLORGREEN,LINETHICK2;

红面积:SUM(MACD,BARSLAST(MACD<0))*(MACD>0),COLOR0000FF,NODRAW;
绿面积:SUM(MACD,BARSLAST(MACD>0))*(MACD<0),COLORFFFF00,NODRAW;
 AA:=ROUND(REF(绿面积,1)*100);BB:=ROUND(REF(红面积,1)*100);
 DRAWNUMBER(CROSS(0,MACD),0.04,ABS(BB)),COLORMAGENTA;
 DRAWNUMBER(CROSS(MACD,0),-0.01,ABS(AA)),COLORGREEN;

{CCI}
 TYP:=(HIGH+LOW+CLOSE)/3;
 CCI:=(TYP-MA(TYP,14))/(0.015*AVEDEV(TYP,14));
 {BOLL}
 BOLL:=MA(CLOSE,20);
 UB:=BOLL+2*STD(CLOSE,20);
 LB:=BOLL-2*STD(CLOSE,20);
 {KDJ}
 RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
 K:=SMA(RSV,3,1);
 D:=SMA(K,3,1);
 J:=3*K-2*D;
 PP:=CCI<-160 AND CLOSE<LB AND J<20;
 QQ:=CCI>160 AND J>100;
 {KDJ中J值在0-90间为黄色,小于0为绿色,大于90为红色}
 {显示J值和CCI值}

{CCI值小于160且收盘价在BOLL下轨一下,J值小于20为红色箭头,CCI大于160且J值大于100为绿色箭头}
DRAWICON(QQ,0,2);
 DRAWICON(PP,0,1);

KDJ金叉:=BARSLAST(REF(CROSS(J,D),1));
 KDJ死叉:=BARSLAST(REF(CROSS(D,J),1));
 KDJ上次金叉:=SUMBARS(REF(CROSS(J,D),1),2);
 KDJ上次死叉:=SUMBARS(REF(CROSS(D,J),1),2);
 {KDJ底背离}
AAA1:=BARSLAST(REF(CROSS(J,D),1));
 KDJ次低点:=LLV(J,AAA1);
 KDJ最低点:=LLV(J,KDJ上次死叉);
KDJ底背离:=REF(CLOSE,AAA1+1)>CLOSE AND KDJ次低点>KDJ最低点 AND CROSS(J,D);
 DRAWTEXT(KDJ底背离,MACD,'KDJ底'),COLORRED;
 STICKLINE(KDJ底背离,MACD,0,2,0),COLORRED;
 {KDJ顶背离}
BBB1:=BARSLAST(REF(CROSS(D,J),1));
 KDJ次高点:=HHV(J,AAA1);
 KDJ最高点:=HHV(J,KDJ上次金叉);
KDJ顶背离:=REF(CLOSE,BBB1+1)<CLOSE AND KDJ次高点<KDJ最高点 AND CROSS(D,J);
 DRAWTEXT(KDJ顶背离,MACD,'KDJ顶'),COLORGREEN;
 STICKLINE(KDJ顶背离,MACD,0,2,0),COLORGREEN;


 {九转}
A1:=C>=REF(C,4);
 A2:=C<REF(C,4);
 A3:=C<REF(C,4) AND REF(A1,1);
 T:=BARSLAST(A3),NODRAW;
 M0:=(T=0 AND REFX(T=1 AND NOT(A2),1)) OR (REFX(T=2 AND NOT(A2),2)) OR (REFX(T=3 AND NOT(A2),3)) OR (REFX(T=4 AND NOT(A2),4)) OR (REFX(T=5 AND NOT(A2),5)) OR (REFX(T=6 AND NOT(A2),6)) OR (REFX(T=7 AND NOT(A2),7)) OR (REFX(T=8 AND NOT(A2),8));
 M1:=T=1 AND REFX(T=2 AND NOT(A2),1) OR (REFX(T=3 AND NOT(A2),2)) OR (REFX(T=4 AND NOT(A2),3)) OR (REFX(T=5 AND NOT(A2),4)) OR (REFX(T=6 AND NOT(A2),5)) OR (REFX(T=7 AND NOT(A2),6)) OR (REFX(T=8 AND NOT(A2),7));
 M2:=T=2 AND REFX(T=3 AND NOT(A2),1) OR (REFX(T=4 AND NOT(A2),2)) OR (REFX(T=5 AND NOT(A2),3)) OR (REFX(T=6 AND NOT(A2),4)) OR (REFX(T=7 AND NOT(A2),5)) OR (REFX(T=8 AND NOT(A2),6));
 M3:=T=3 AND REFX(T=4 AND NOT(A2),1)OR (REFX(T=5 AND NOT(A2),2)) OR (REFX(T=6 AND NOT(A2),3)) OR (REFX(T=7 AND NOT(A2),4)) OR (REFX(T=8 AND NOT(A2),5));
 M4:=T=4 AND REFX(T=5 AND NOT(A2),1) OR (REFX(T=6 AND NOT(A2),2)) OR (REFX(T=7 AND NOT(A2),3)) OR (REFX(T=8 AND NOT(A2),4));
 M5:=T=5 AND REFX(T=6 AND NOT(A2),1) OR (REFX(T=7 AND NOT(A2),2)) OR (REFX(T=8 AND NOT(A2),3));
M6:=T=6 AND REFX(T=7 AND NOT(A2),1) OR (REFX(T=8 AND NOT(A2),2));
 M7:=T=7 AND REFX(T=8 AND NOT(A2),1);
 N0:=T=1 AND REF(T=0 AND A3,1) AND A2;
 N1:=T=2 AND REF(N0,1) AND A2;
 N2:=T=3 AND REF(N1,1) AND A2;
 N3:=T=4 AND REF(N2,1) AND A2;
 N4:=T=5 AND REF(N3,1) AND A2;
 N5:=T=6 AND REF(N4,1) AND A2;
 N6:=T=7 AND REF(N5,1) AND A2;
 N7:=T=8 AND REF(N6,1) AND A2;
 WZD:=DEA;
 WZG:=DEA;

DRAWTEXT(N6 AND NOT(M7),WZD,'8'),COLORGREEN;
 DRAWTEXT(N7,WZG,'9'),COLORMAGENTA;
 B1:=C<=REF(C,4);
 B2:=C>REF(C,4);
 B3:=C>REF(C,4) AND REF(B1,1);
 T1:=BARSLAST(B3),NODRAW;
 M8:=(T1=0 AND REFX(T1=1 AND NOT(B2),1)) OR (REFX(T1=2 AND NOT(B2),2)) OR (REFX(T1=3 AND NOT(B2),3)) OR (REFX(T1=4 AND NOT(B2),4)) OR (REFX(T1=5 AND NOT(B2),5)) OR (REFX(T1=6 AND NOT(B2),6)) OR (REFX(T1=7 AND NOT(B2),7)) OR (REFX(T1=8 AND NOT(B2),8));
 M9:=T1=1 AND REFX(T1=2 AND NOT(B2),1) OR (REFX(T1=3 AND NOT(B2),2)) OR (REFX(T1=4 AND NOT(B2),3)) OR (REFX(T1=5 AND NOT(B2),4)) OR (REFX(T1=6 AND NOT(B2),5)) OR (REFX(T1=7 AND NOT(B2),6)) OR (REFX(T1=8 AND NOT(B2),7));
 M10:=T1=2 AND REFX(T1=3 AND NOT(B2),1) OR (REFX(T1=4 AND NOT(B2),2)) OR (REFX(T1=5 AND NOT(B2),3)) OR (REFX(T1=6 AND NOT(B2),4)) OR (REFX(T1=7 AND NOT(B2),5)) OR (REFX(T1=8 AND NOT(B2),6));
 M11:=T1=3 AND REFX(T1=4 AND NOT(B2),1)OR (REFX(T1=5 AND NOT(B2),2)) OR (REFX(T1=6 AND NOT(B2),3)) OR (REFX(T1=7 AND NOT(B2),4)) OR (REFX(T1=8 AND NOT(B2),5));
 M12:=T1=4 AND REFX(T1=5 AND NOT(B2),1) OR (REFX(T1=6 AND NOT(B2),2)) OR (REFX(T1=7 AND NOT(B2),3)) OR (REFX(T1=8 AND NOT(B2),4));
 M13:=T1=5 AND REFX(T1=6 AND NOT(B2),1) OR (REFX(T1=7 AND NOT(B2),2)) OR (REFX(T1=8 AND NOT(B2),3));
 M14:=T1=6 AND REFX(T1=7 AND NOT(B2),1) OR (REFX(T1=8 AND NOT(B2),2));
 M15:=T1=7 AND REFX(T1=8 AND NOT(B2),1);
 N8:=T1=1 AND REF(T1=0 AND B3,1) AND B2;
 N9:=T1=2 AND REF(N8,1) AND B2;
 N10:=T1=3 AND REF(N9,1) AND B2;
 N11:=T1=4 AND REF(N10,1) AND B2;
 N12:=T1=5 AND REF(N11,1) AND B2;
 N13:=T1=6 AND REF(N12,1) AND B2;
 N14:=T1=7 AND REF(N13,1) AND B2;
 N15:=T1=8 AND REF(N14,1) AND B2;

DRAWTEXT(N14 AND NOT(M15),WZG,'8'),COLOR9900CC;
 DRAWTEXT(N15 ,WZD,'9'),COLORGREEN;

 




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

解密、定制、编写公式指标请联系QQ或微信同号:88652583
置顶指标

相关指标公式

输出本公式带有九转序列,MACD背离,KDJ背离,MACD面积 ,出现红色箭头表示CCI值小于-150,且KDJ的J值小于20.其他的自己研究 DIFF:收盘价的12日指数移动平均 - 收盘价的26日指数移动平均
输出 DEA:DIFF的9日指数移动平均
输出 平滑异同平均线:2*(DIFF-DEA), COLORSTICK,显示在位置之上
MACD金叉赋值:上次1日前的DIFF上穿DEA距今天数
MACD死叉赋值:上次1日前的DEA上穿DIFF距今天数
MACD上次金叉赋值:1日前的DIFF上穿DEA累加至2的天数
MACD上次死叉赋值:1日前的DEA上穿DIFF累加至2的天数
MACD次低点赋值:MACD金叉日内DIFF的最低值
MACD最低点赋值:MACD上次死叉日内DIFF的最低值
MACD底背离赋值:MACD金叉+1日前的收盘价>收盘价 AND MACD次低点>MACD最低点 AND DIFF上穿DEA
当满足条件MACD金叉=0时,在DEA位置画直线起点,当满足条件MACD底背离时,在DEA位置画直线终点,0表示是否延长.,画红色,线宽为2
MACD次高点赋值:MACD金叉日内DIFF的最高值
MACD最高点赋值:MACD上次金叉日内DIFF的最高值
MACD顶背离赋值:MACD死叉+1日前的收盘价<收盘价 AND MACD次高点 当满足条件MACD死叉=0时,在DEA位置画直线起点,当满足条件MACD顶背离时,在DEA位置画直线终点,0表示是否延长.,画绿色,线宽为2
输出红面积:MACD的上次MACD<0距今天数日累和*(MACD>0),COLOR0000FF,NODRAW
输出绿面积:MACD的上次MACD>0距今天数日累和*(MACD<0),COLORFFFF00,NODRAW
AA赋值:对1日前的绿面积*100(进行)四舍五入
BB赋值:对1日前的红面积*100(进行)四舍五入
当满足条件0上穿MACD时,在0.04位置书写数字,画洋红色
当满足条件MACD上穿0时,在-0.01位置书写数字,画绿色
TYP赋值:(最高价+最低价+收盘价)/3
CCI赋值:(TYP-TYP的14日简单移动平均)/(0.015*TYP的14日平均绝对偏差)
BOLL赋值:收盘价的20日简单移动平均
UB赋值:BOLL+2*收盘价的20日估算标准差
LB赋值:BOLL-2*收盘价的20日估算标准差
RSV赋值:(收盘价-9日内最低价的最低值)/(9日内最高价的最高值-9日内最低价的最低值)*100
K赋值:RSV的3日[1日权重]移动平均
D赋值:K的3日[1日权重]移动平均
J赋值:3*K-2*D
PP赋值:CCI<-160 AND 收盘价QQ赋值:CCI>160 AND J>100
当满足条件QQ时,在0位置画2号图标
当满足条件PP时,在0位置画1号图标
KDJ金叉赋值:上次1日前的J上穿D距今天数
KDJ死叉赋值:上次1日前的D上穿J距今天数
KDJ上次金叉赋值:1日前的J上穿D累加至2的天数
KDJ上次死叉赋值:1日前的D上穿J累加至2的天数
AAA1赋值:上次1日前的J上穿D距今天数
KDJ次低点赋值:AAA1日内J的最低值
KDJ最低点赋值:KDJ上次死叉日内J的最低值
KDJ底背离赋值:AAA1+1日前的收盘价>收盘价 AND KDJ次低点>KDJ最低点 AND J上穿D
当满足条件KDJ底背离时,在MACD位置书写文字,画红色
当满足条件KDJ底背离时,在MACD和0位置之间画柱状线,宽度为2,0不为0则画空心柱.,画红色
BBB1赋值:上次1日前的D上穿J距今天数
KDJ次高点赋值:AAA1日内J的最高值
KDJ最高点赋值:KDJ上次金叉日内J的最高值
KDJ顶背离赋值:BBB1+1日前的收盘价<收盘价 AND KDJ次高点 当满足条件KDJ顶背离时,在MACD位置书写文字,画绿色
当满足条件KDJ顶背离时,在MACD和0位置之间画柱状线,宽度为2,0不为0则画空心柱.,画绿色
A1赋值:收盘价>=4日前的收盘价
A2赋值:收盘价<4日前的收盘价
A3赋值:收盘价<4日前的收盘价 AND 1日前的A1
T赋值:上次A3距今天数,NODRAW
M0赋值:(T=0 AND 1日后的T=1ANDNOT(A2)) OR (2日后的T=2ANDNOT(A2)) OR (3日后的T=3ANDNOT(A2)) OR (4日后的T=4ANDNOT(A2)) OR (5日后的T=5ANDNOT(A2)) OR (6日后的T=6ANDNOT(A2)) OR (7日后的T=7ANDNOT(A2)) OR (8日后的T=8ANDNOT(A2))
M1赋值:T=1 AND 1日后的T=2ANDNOT(A2) OR (2日后的T=3ANDNOT(A2)) OR (3日后的T=4ANDNOT(A2)) OR (4日后的T=5ANDNOT(A2)) OR (5日后的T=6ANDNOT(A2)) OR (6日后的T=7ANDNOT(A2)) OR (7日后的T=8ANDNOT(A2))
M2赋值:T=2 AND 1日后的T=3ANDNOT(A2) OR (2日后的T=4ANDNOT(A2)) OR (3日后的T=5ANDNOT(A2)) OR (4日后的T=6ANDNOT(A2)) OR (5日后的T=7ANDNOT(A2)) OR (6日后的T=8ANDNOT(A2))
M3赋值:T=3 AND 1日后的T=4ANDNOT(A2)OR (2日后的T=5ANDNOT(A2)) OR (3日后的T=6ANDNOT(A2)) OR (4日后的T=7ANDNOT(A2)) OR (5日后的T=8ANDNOT(A2))
M4赋值:T=4 AND 1日后的T=5ANDNOT(A2) OR (2日后的T=6ANDNOT(A2)) OR (3日后的T=7ANDNOT(A2)) OR (4日后的T=8ANDNOT(A2))
M5赋值:T=5 AND 1日后的T=6ANDNOT(A2) OR (2日后的T=7ANDNOT(A2)) OR (3日后的T=8ANDNOT(A2))
M6赋值:T=6 AND 1日后的T=7ANDNOT(A2) OR (2日后的T=8ANDNOT(A2))
M7赋值:T=7 AND 1日后的T=8ANDNOT(A2)
N0赋值:T=1 AND 1日前的T=0ANDA3 AND A2
N1赋值:T=2 AND 1日前的N0 AND A2
N2赋值:T=3 AND 1日前的N1 AND A2
N3赋值:T=4 AND 1日前的N2 AND A2
N4赋值:T=5 AND 1日前的N3 AND A2
N5赋值:T=6 AND 1日前的N4 AND A2
N6赋值:T=7 AND 1日前的N5 AND A2
N7赋值:T=8 AND 1日前的N6 AND A2
WZD赋值:DEA
WZG赋值:DEA
当满足条件N6ANDNOT(M7)时,在WZD位置书写文字,画绿色
当满足条件N7时,在WZG位置书写文字,画洋红色
B1赋值:收盘价<=4日前的收盘价
B2赋值:收盘价>4日前的收盘价
B3赋值:收盘价>4日前的收盘价 AND 1日前的B1
T1赋值:上次B3距今天数,NODRAW
M8赋值:(T1=0 AND 1日后的T1=1ANDNOT(B2)) OR (2日后的T1=2ANDNOT(B2)) OR (3日后的T1=3ANDNOT(B2)) OR (4日后的T1=4ANDNOT(B2)) OR (5日后的T1=5ANDNOT(B2)) OR (6日后的T1=6ANDNOT(B2)) OR (7日后的T1=7ANDNOT(B2)) OR (8日后的T1=8ANDNOT(B2))
M9赋值:T1=1 AND 1日后的T1=2ANDNOT(B2) OR (2日后的T1=3ANDNOT(B2)) OR (3日后的T1=4ANDNOT(B2)) OR (4日后的T1=5ANDNOT(B2)) OR (5日后的T1=6ANDNOT(B2)) OR (6日后的T1=7ANDNOT(B2)) OR (7日后的T1=8ANDNOT(B2))
M10赋值:T1=2 AND 1日后的T1=3ANDNOT(B2) OR (2日后的T1=4ANDNOT(B2)) OR (3日后的T1=5ANDNOT(B2)) OR (4日后的T1=6ANDNOT(B2)) OR (5日后的T1=7ANDNOT(B2)) OR (6日后的T1=8ANDNOT(B2))
M11赋值:T1=3 AND 1日后的T1=4ANDNOT(B2)OR (2日后的T1=5ANDNOT(B2)) OR (3日后的T1=6ANDNOT(B2)) OR (4日后的T1=7ANDNOT(B2)) OR (5日后的T1=8ANDNOT(B2))
M12赋值:T1=4 AND 1日后的T1=5ANDNOT(B2) OR (2日后的T1=6ANDNOT(B2)) OR (3日后的T1=7ANDNOT(B2)) OR (4日后的T1=8ANDNOT(B2))
M13赋值:T1=5 AND 1日后的T1=6ANDNOT(B2) OR (2日后的T1=7ANDNOT(B2)) OR (3日后的T1=8ANDNOT(B2))
M14赋值:T1=6 AND 1日后的T1=7ANDNOT(B2) OR (2日后的T1=8ANDNOT(B2))
M15赋值:T1=7 AND 1日后的T1=8ANDNOT(B2)
N8赋值:T1=1 AND 1日前的T1=0ANDB3 AND B2
N9赋值:T1=2 AND 1日前的N8 AND B2
N10赋值:T1=3 AND 1日前的N9 AND B2
N11赋值:T1=4 AND 1日前的N10 AND B2
N12赋值:T1=5 AND 1日前的N11 AND B2
N13赋值:T1=6 AND 1日前的N12 AND B2
N14赋值:T1=7 AND 1日前的N13 AND B2
N15赋值:T1=8 AND 1日前的N14 AND B2
当满足条件N14ANDNOT(M15)时,在WZG位置书写文字,COLOR9900CC
当满足条件N15时,在WZD位置书写文字,画绿色

指标安装下载帮助  |   联系我们  |  股朋指标网  |  指标网   |  指标公式  |   加入收藏   |  设为主页

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