顶底背离通达信公式 副图 源码附图
MA1:MA(C,5);
MA2:MA(C,10);
MA3:MA(C,30);
A1:=BARSLAST(REF(CROSS("MACD.DIF"(12,26,9),"MACD.DEA"(12,26,9)),1));
B1:=REF(C,A1+1)>C AND REF("MACD.DIF"(12,26,9),A1+1)<"MACD.DIF"(12,26,9) AND CROSS("MACD.DIF"(12,26,9),"MACD.DEA"(12,26,9));
底背离MACD:DRAWTEXT(FILTER(B1>0,5),LOW,'1'),COLORYELLOW;
DRAWTEXT(FILTER(B1>0,5),LOW*0.98,'MACD底背离'),COLOR00FF00;
A2:=BARSLAST(REF(CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3)),1));
B2:=REF(C,A2+1)>C AND REF("KDJ.K"(9,3,3),A2+1)<"KDJ.K"(9,3,3) AND CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3));
底背离KDJ:DRAWTEXT(FILTER(B2>0,5),LOW,'▲'),COLORYELLOW;
DRAWTEXT(FILTER(B2>0,5),LOW*0.98,'KDJ底背离'),COLORRED;
A3:=BARSLAST(REF(CROSS("RSI.RSI1"(8,55,55),"RSI.RSI2"(8,55,55)),1));
B3:=REF(C,A3+1)>C AND REF("RSI.RSI1"(8,55,55),A3+1)<"RSI.RSI1"(8,55,55) AND CROSS("RSI.RSI1"(8,55,55),"RSI.RSI2"(8,55,55));
底背离RSI:DRAWTEXT(FILTER(B3>0,5),LOW,'▲'),COLORYELLOW;
DRAWTEXT(FILTER(B3>0,5),LOW*0.98,'RSI底背离'),COLORF0F000;
A4:=BARSLAST(REF(CROSS("DMI.PDI"(14,6),"DMI.MDI"(14,6)),1));
B4:=REF(C,A4+1)>C AND REF("DMI.PDI"(14,6),A4+1)<"DMI.PDI"(14,6) AND CROSS("DMI.PDI"(14,6),"DMI.MDI"(14,6));
底背离DMI:DRAWTEXT(FILTER(B4>0,5),LOW,'▲'),COLORYELLOW;
DRAWTEXT(FILTER(B4>0,5),LOW*0.98,'DMI底背离'),COLORF00FF0;
C1:=BARSLAST(REF(CROSS("MACD.DEA"(12,26,9),"MACD.DIF"(12,26,9)),1));
D1:=REF(C,C1+1)<C AND REF("MACD.DIF"(12,26,9),C1+1)>"MACD.DIF"(12,26,9) AND CROSS("MACD.DEA"(12,26,9),"MACD.DIF"(12,26,9));
顶背离MACD:DRAWTEXT(FILTER(D1>0,5),HIGH*1.02,'▲'),COLOR00FF00;
DRAWTEXT(FILTER(D1>0,5),HIGH*1.04,'MACD顶背离'),COLORRED;
C2:=BARSLAST(REF(CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3)),1));
D2:=REF(C,C2+1)<C AND REF("KDJ.K"(9,3,3),C2+1)>"KDJ.K"(9,3,3) AND CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3));
顶背离KDJ:DRAWTEXT(FILTER(D2>0,5),HIGH*1.02,'▲'),COLOR00FF00;
DRAWTEXT(FILTER(D2>0,5),HIGH*1.04,'KDJ顶背离'),COLORF00FF0;
C3:=BARSLAST(REF(CROSS("RSI.RSI2"(8,55,55),"RSI.RSI1"(8,55,55)),1));
D3:=REF(C,C3+1)<C AND REF("RSI.RSI1"(8,55,55),C3+1)>"RSI.RSI1"(8,55,55) AND CROSS("RSI.RSI2"(8,55,55),"RSI.RSI1"(8,55,55));
顶背离RSI:DRAWTEXT(FILTER(D3>0,5),HIGH*1.02,'▲'),COLOR00FF00;
DRAWTEXT(FILTER(D3>0,5),HIGH*1.04,'RSI顶背离'),COLORYELLOW;
C4:=BARSLAST(REF(CROSS("DMI.MDI"(14,6),"DMI.PDI"(14,6)),1));
D4:=REF(C,C4+1)<C AND REF("DMI.PDI"(14,6),C4+1)>"DMI.PDI"(14,6) AND CROSS("DMI.MDI"(14,6),"DMI.PDI"(14,6));
顶背离DMI:DRAWTEXT(FILTER(D4>0,5),HIGH*1.02,'▲'),COLOR00FF00;
DRAWTEXT(FILTER(D4>0,5),HIGH*1.04,'DMI顶背离'),COLORF0F000;
A201:=SIGNALS_USER(201,0),NODRAW;
DRAWTEXT(A201>0 OR A201<0,L,VARCAT('五天后解禁 ',VAR2STR(A201,0))),COLORGREEN;
DRAWTEXT(A201<0,L,VARCAT('五天后解禁 ',VAR2STR(A201,0))),COLORGREEN;
DRAWTEXT(A201>0 OR A201<0,L,'五天后解禁 '),COLORGREEN;
A101:=SIGNALS_USER(101,0),NODRAW;
DRAWTEXT(A101>0 OR A101<0,H,'解禁日 '),COLORMAGENTA;
DRAWTEXT_FIX(1,0.00,0.16,0,'解禁日期:')COLORGREEN;
DRAWTEXT_FIX(1,0.05,0.16,0,EXTERNSTR(0,5)),COLOR00FF00,LINETHICK2;
XG:=C>REF(C,1)*1.095 AND C=H;
STICKLINE(XG,C,O,2,0),COLORYELLOW;
STICKLINE(XG,H,L,0,0),COLORYELLOW;
DRAWTEXT(XG,L*0.95,'涨停'),COLORYELLOW;
DRAWTEXT_FIX(1,0.00,0.00,0,'主题投资:'),COLORYELLOW;
DRAWTEXT_FIX(1,0.05,0.00,0,EXTERNSTR(0,1)),COLORYELLOW;
DRAWTEXT_FIX(1,0.00,0.08,0,'热门题材:'),COLORYELLOW;
DRAWTEXT_FIX(1,0.05,0.08,0,EXTERNSTR(0,2)),COLORYELLOW;
来函数检测结果如下:
该公式没有未来函数
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
输出MA1:C的5日简单移动平均
输出MA2:C的10日简单移动平均
输出MA3:C的30日简单移动平均
A1赋值:上次REF(CROSS("MACD.DIF"(12,26,9距今天数,"MACD.DEA"(12,26,9)),1))
B1赋值:A1+1日前的C>C AND REF("MACD.DIF"(12,26,9),A1+1)<"MACD.DIF"(12,26,9) AND CROSS("MACD.DIF"(12,26,9),"MACD.DEA"(12,26,9))
输出底背离MACD:DRAWTEXT(B1>0的5过滤,最低价,'1'),画黄色
DRAWTEXT(B1>0的5过滤,最低价*0.98,'MACD底背离'),COLOR00FF00
A2赋值:上次REF(CROSS("KDJ.K"(9,3,3距今天数,"KDJ.D"(9,3,3)),1))
B2赋值:A2+1日前的C>C AND REF("KDJ.K"(9,3,3),A2+1)<"KDJ.K"(9,3,3) AND CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3))
输出底背离KDJ:DRAWTEXT(B2>0的5过滤,最低价,'▲'),画黄色
DRAWTEXT(B2>0的5过滤,最低价*0.98,'KDJ底背离'),画红色
A3赋值:上次REF(CROSS("RSI.RSI1"(8,55,55距今天数,"RSI.RSI2"(8,55,55)),1))
B3赋值:A3+1日前的C>C AND REF("RSI.RSI1"(8,55,55),A3+1)<"RSI.RSI1"(8,55,55) AND CROSS("RSI.RSI1"(8,55,55),"RSI.RSI2"(8,55,55))
输出底背离RSI:DRAWTEXT(B3>0的5过滤,最低价,'▲'),画黄色
DRAWTEXT(B3>0的5过滤,最低价*0.98,'RSI底背离'),COLORF0F000
A4赋值:上次REF(CROSS("DMI.PDI"(14,6距今天数,"DMI.MDI"(14,6)),1))
B4赋值:A4+1日前的C>C AND REF("DMI.PDI"(14,6),A4+1)<"DMI.PDI"(14,6) AND CROSS("DMI.PDI"(14,6),"DMI.MDI"(14,6))
输出底背离DMI:DRAWTEXT(B4>0的5过滤,最低价,'▲'),画黄色
DRAWTEXT(B4>0的5过滤,最低价*0.98,'DMI底背离'),COLORF00FF0
C1赋值:上次REF(CROSS("MACD.DEA"(12,26,9距今天数,"MACD.DIF"(12,26,9)),1))
D1赋值:C1+1日前的C"MACD.DIF"(12,26,9) AND CROSS("MACD.DEA"(12,26,9),"MACD.DIF"(12,26,9))
输出顶背离MACD:DRAWTEXT(D1>0的5过滤,最高价*1.02,'▲'),COLOR00FF00
DRAWTEXT(D1>0的5过滤,最高价*1.04,'MACD顶背离'),画红色
C2赋值:上次REF(CROSS("KDJ.D"(9,3,3距今天数,"KDJ.K"(9,3,3)),1))
D2赋值:C2+1日前的C"KDJ.K"(9,3,3) AND CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3))
输出顶背离KDJ:DRAWTEXT(D2>0的5过滤,最高价*1.02,'▲'),COLOR00FF00
DRAWTEXT(D2>0的5过滤,最高价*1.04,'KDJ顶背离'),COLORF00FF0
C3赋值:上次REF(CROSS("RSI.RSI2"(8,55,55距今天数,"RSI.RSI1"(8,55,55)),1))
D3赋值:C3+1日前的C"RSI.RSI1"(8,55,55) AND CROSS("RSI.RSI2"(8,55,55),"RSI.RSI1"(8,55,55))
输出顶背离RSI:DRAWTEXT(D3>0的5过滤,最高价*1.02,'▲'),COLOR00FF00
DRAWTEXT(D3>0的5过滤,最高价*1.04,'RSI顶背离'),画黄色
C4赋值:上次REF(CROSS("DMI.MDI"(14,6距今天数,"DMI.PDI"(14,6)),1))
D4赋值:C4+1日前的C"DMI.PDI"(14,6) AND CROSS("DMI.MDI"(14,6),"DMI.PDI"(14,6))
输出顶背离DMI:DRAWTEXT(D4>0的5过滤,最高价*1.02,'▲'),COLOR00FF00
DRAWTEXT(D4>0的5过滤,最高价*1.04,'DMI顶背离'),COLORF0F000
A201:=SIGNALS_USER(201,0),NODRAW
DRAWTEXT(A201>0 OR A201<0,L,VARCAT('五天后解禁 ',VAR2STR(A201,0))),画绿色
DRAWTEXT(A201<0,L,VARCAT('五天后解禁 ',VAR2STR(A201,0))),画绿色
当满足条件A201>0 OR A201<0时,在L和'五天后解禁 '位置书写文字
A101:=SIGNALS_USER(101,0),NODRAW
当满足条件A101>0 OR A101<0时,在H和'解禁日 '位置书写文字
当满足条件1时,在横轴0.00纵轴0.16位置书写文字
DRAWTEXT_FIX(1,0.05,0.16,0,EXTERNSTR(0,5)),COLOR00FF00, 线宽为2
XG赋值:C>1日前的C*1.095 AND C=H
当满足条件XG时,在C和O之间画柱状线
当满足条件XG时,在H和L之间画柱状线
当满足条件XG时,在L*0.95和'涨停'位置书写文字
当满足条件1时,在横轴0.00纵轴0.00位置书写文字
DRAWTEXT_FIX(1,0.05,0.00,0,EXTERNSTR(0,1)),画黄色
当满足条件1时,在横轴0.00纵轴0.08位置书写文字
DRAWTEXT_FIX(1,0.05,0.08,0,EXTERNSTR(0,2)),画黄色