通达信顶底背离主图,源码,说明
操作说明;所谓背离,说的是股价走势与技术指标、成交量的背离。是指股价在高位(或低位)形成两重或多重顶(底),同时后一顶(底)比前一顶(底)更高(低),而你所习惯使用的技术指标
(通常为MACD、KDJ、RSI,更为主要的成交量)却走出一顶(底)比一顶(底)更低(高)的形态。背离的发生一定要和成交量的变化同时观察才会有准确的判断。背离发生的理想形态:先一尖顶,
后一圆顶,伴随着成交量的变化(先大后小),当后一顶形成并且股价落到M顶颈线下方时,务必离场。或在第一次反弹到颈线位,而不能有效突破颈线时离场。
【顶底背离】主图源码
VAR1:=CLOSE>REF(CLOSE,1) AND CLOSE>REF(CLOSE,2);
VAR2:=REF(VAR1,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR3:=REF(VAR2,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR4:=REF(VAR3,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR5:=REF(VAR4,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR6:=REF(VAR5,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR7:=REF(VAR6,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR8:=REF(VAR7,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR9:=REF(VAR8,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VARA:=REF(VAR9,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VARB:=REF(VARA,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VARC:=REF(VARB,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
STICKLINE(VAR1 OR VAR2 OR VAR3 OR VAR4 OR VAR5 OR VAR6 OR VAR7 OR VAR8 OR VAR9 OR VARA OR VARB OR VARC,CLOSE,REF(CLOSE,1),3,0),COLORRED;
VARD:=CLOSE<REF(CLOSE,1) AND CLOSE<REF(CLOSE,2);
VARE:=REF(VARD,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VARF:=REF(VARE,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR10:=REF(VARF,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR11:=REF(VAR10,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR12:=REF(VAR11,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR13:=REF(VAR12,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR14:=REF(VAR13,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR15:=REF(VAR14,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR16:=REF(VAR15,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR17:=REF(VAR16,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR18:=REF(VAR17,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
STICKLINE(VARD OR VARE OR VARF OR VAR10 OR VAR11 OR VAR12 OR VAR13 OR VAR14 OR VAR15 OR VAR16 OR VAR17 OR VAR18,CLOSE,REF(CLOSE,1),3,0),COLORYELLOW;
VAR19:=REF(VARD OR VARE OR VARF OR VAR10 OR VAR11 OR VAR12 OR VAR13 OR VAR14 OR VAR15 OR VAR16 OR VAR17 OR VAR18,1) AND VAR1;
STICKLINE(VAR19,REF(CLOSE,1),REF(CLOSE,2),3,0),COLORMAGENTA;
VAR1A:=REF(VAR1 OR VAR2 OR VAR3 OR VAR4 OR VAR5 OR VAR6 OR VAR7 OR VAR8 OR VAR9 OR VARA OR VARB OR VARC,1) AND VARD;
STICKLINE(VAR1A,REF(CLOSE,1),REF(CLOSE,2),3,0),COLOR008800;
A:=MA(CLOSE,17)+ABS(MA(CLOSE,17)-REF(MA(CLOSE,17),1));
B:=MA(CLOSE,17)+MA(CLOSE,17)-REF(MA(CLOSE,17),1);
中线:IF(MA(CLOSE,17)<B,B,MA(CLOSE,17)),COLORMAGENTA,LINETHICK2;
操作线:=中线-(EMA(C,3)-中线),COLOR00FFFF,LINETHICK2;
PM:MA(C,5),COLORRED ,LINETHICK2;
IF(PM> REF(PM,1),PM,DRAWNULL),COLORLIGRAY ,LINETHICK2;
IF(PM=REF(PM,1),PM,DRAWNULL),COLORLIGRAY ;
IF(PM<REF(PM,1),PM,DRAWNULL), COLORFF9900,LINETHICK2;
S:=(PM> 操作线);
DD:=中线<REF(中线,1);
IF(DD,中线,DRAWNULL),COLORLIGREEN ,LINETHICK2;
IF(S,中线,DRAWNULL),COLORLIGREEN ,POINTDOT,LINETHICK4;
DRAWICON(CROSS(中线,操作线),中线-0.4,11);
A1:=BARSLAST(REF(CROSS("MACD.DIF","MACD.DEA"),1));
B1:=REF(C,A1+1)> C AND REF("MACD.DIF",A1+1)<"MACD.DIF" AND CROSS("MACD.DIF","MACD.DEA");
DRAWTEXT(B1> 0,L-0.02,'*M底'),COLOR00FFFF;
A2:=BARSLAST(REF(CROSS("KDJ.K","KDJ.D"),1));
B2:=REF(C,A2+1)> C AND REF("KDJ.K",A2+1)<"KDJ.K" AND CROSS("KDJ.K","KDJ.D");
DRAWTEXT(B2,L-0.10,'*K底'),COLORFF00FF;
A3:=BARSLAST(REF(CROSS("RSI.RSI1","RSI.RSI2"),1));
B3:=REF(C,A3+1)> C AND REF("RSI.RSI1",A3+1)<"RSI.RSI1" AND CROSS("RSI.RSI1","RSI.RSI2");
DRAWTEXT(B3> 0,L-0.18,'*R底'),COLOR0000FF;
C1:=BARSLAST(REF(CROSS("MACD.DEA","MACD.DIF"),1));
D1:=REF(C,C1+1)<C AND REF("MACD.DIF",C1+1)> "MACD.DIF" AND CROSS("MACD.DEA","MACD.DIF");
DRAWTEXT(D1> 0,H+0.30,'*M顶'),COLOR00FF00;
C2:=BARSLAST(REF(CROSS("KDJ.D","KDJ.K"),1));
D2:=REF(C,C2+1)<C AND REF("KDJ.K",C2+1)> "KDJ.K" AND CROSS("KDJ.D","KDJ.K");
DRAWTEXT(D2> 0,H+0.25,'*K顶'),COLORFFFFCC;
C3:=BARSLAST(REF(CROSS("RSI.RSI2","RSI.RSI1"),1));
D3:=REF(C,C3+1)<C AND REF("RSI.RSI1",C3+1)> "RSI.RSI1" AND CROSS("RSI.RSI2","RSI.RSI1");
DRAWTEXT(D3> 0,H+0.13,'*R顶'),COLORFF9900;
V1:=DMA((((HIGH + LOW) + (CLOSE * 2)) / 4.15),0.9);
V2:=(1-7/100)*(DMA(CLOSE,V1));
决策:REFDATE(V2,DATE),,LINETHICK2,COLORLIGRAY;
DRAWTEXT(ISLASTBAR,决策,'*决策线'),COLORWHITE;
{以下含未来函数,不影响以上参数,不喜欢可删除}
DRAWTEXT_FIX(1,0.00,0,0,'所属行业:')COLORRED;
DRAWTEXT_FIX(1,0.07,0,0,HYBLOCK)COLORRED;
DRAWTEXT_FIX(1,0.14,0,0,'所属地区:')COLORLIBLUE;
DRAWTEXT_FIX(1,0.21,0,0,DYBLOCK)COLOR00FFFF;
DRAWTEXT_FIX(1,0.00,0.12,0,'财务分折:')COLORMAGENTA;
DRAWTEXT_FIX(1,0.07,0.06,0,EXTERNSTR(0,1))COLOR0000FF;
DRAWTEXT_FIX (1,0.05,0.12,0,'现金流:'),COLOR00CCCC;
DRAWNUMBER_FIX(1,0.086,0.12,0,CONST(FINANCE(25)/1000000000)),COLOR00CCCC;
DRAWTEXT_FIX (1,0.125,0.12,0,'应收款:'),COLOR00CCCC;
DRAWNUMBER_FIX(1,0.159,0.12,0,CONST(FINANCE(22)/100000000)),COLOR00CCCC;
DRAWTEXT_FIX (1,0.193,0.12,0,'存货:'),COLOR00CCCC;
DRAWNUMBER_FIX(1,0.218,0.12,0,CONST(FINANCE(27)/100000000)),COLOR00CCCC;
DRAWTEXT_FIX(1,0.253,0.12,0,'流动比率:'),COLOR00CCCC;{流动比率值>1.5<2.5较为合理,低于1说明偿债能力欠佳。}
DRAWNUMBER_FIX(1,0.299,0.12,0,CONST(FINANCE(11)/FINANCE(15))),COLOR00CCCC;
DRAWTEXT_FIX(1,0.336,0.12,0,'速动比率:'),COLOR00CCCC;
DRAWNUMBER_FIX(1,0.383,0.12,0,CONST(FINANCE(11)-FINANCE(27)/FINANCE(15))),COLOR00CCCC;
DRAWTEXT_FIX (1,0.47,0.12,0,'套牢盘%:'),COLOR00CCCC;
DRAWNUMBER_FIX(1,0.507,0.12,0,CONST(100-WINNER(CLOSE)*100)),COLOR00CCCC;