通达信均线箱体差值主图指标 源码
均线箱体差值主图指标试想通过均线、均线角度线、箱体、KDJ指标及差值综合显示买卖信号:
1,利用20日均线的走势及角度线变化的情况显示买卖时机;
2,利用20日均线与差的交叉情况给出买卖的指示信号;
3,运用传统KDJ指标中K,D及J线的变化情况{上翘及下拐},判断买卖时机;
4,集中在图形底部运用两条彩条进行比较,得出买卖的合理辨别、
均线箱体差主图指标源码:
高:=REF(HHV(H,2),10);
低:=REF(LLV(L,2),10);
顶点:=REFDATE(高,DATE),COLORWHITE;
低点:=REFDATE(低,DATE),COLORWHITE;
{DRAWBAND(顶点,RGB(0,150,160),低点,RGB(0,0,0));}
差:=高-(高-低),COLOR00FFFF,LINETHICK2;
EMA20:=MA(CLOSE,20),COLORFFFFFF,LINETHICK3;
DRAWBAND(EMA20,RGB(120,0,130),差,RGB(0,0,0));
差值:高-(高-低),COLOR00FFFF,LINETHICK1;
箱顶:MA(REF(HHV(C,30),1),2),DOTLINE,LINETHICK1,COLOR00FF00;
箱底:MA(REF(LLV(C,30),1),2),DOTLINE,COLORFFFF00;
C1:=C>=差;
C2:=C<差;
AA:=C1>=C2 ;
BB:=C2>C1 ;
STICKLINE(AA,H,C,0,0),COLOR225588;
STICKLINE(AA,H,C,0,0),COLOR66CCFF;
STICKLINE(AA,O,L,0,0),COLOR225588;
STICKLINE(AA,O,L,0,0),COLOR66CCFF;
STICKLINE(BB,H,C,0,0),COLOR888800;
STICKLINE(BB,H,C,0,0),COLORFFFF00;
STICKLINE(BB,O,L,0,0),COLOR888800;
STICKLINE(BB,O,L,0,0),COLORFFFF00;
STICKLINE(AA,C,O,3.4,0),COLORAA00AA;
STICKLINE(AA,C,O,3.0,0),COLORBB00BB ;
STICKLINE(AA,C,O,2.2,0),COLORCC00CC;
STICKLINE(AA,C,O,1.6,0),COLOREE00EE;
STICKLINE(AA,C,O,1.2,0),COLORFF00FF;
STICKLINE(AA,C,O,0.6,0),COLORFF00FF;
STICKLINE(AA,H,L,0,0),COLORFF00FF;
STICKLINE(BB,C,O,3.4,0),COLOR888800;
STICKLINE(BB,C,O,3.0,0),COLOR999900;
STICKLINE(BB,C,O,2.2,0),COLORAAAA00;
STICKLINE(BB,C,O,1.6,0),COLORCCCC00;
STICKLINE(BB,C,O,1.2,0),COLORDDDD00;
STICKLINE(BB,C,O,0.6,0),COLOREEEE00;
STICKLINE(BB,C,O,0.1,0),COLORFFFF00;
LC5:=REF(CLOSE,1);
RSI5:=SMA(MAX(CLOSE-LC5,0),6,1)/SMA(ABS(CLOSE-LC5),6,1)*100;
R:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
A:=SMA(R,3,1);
B:=SMA(A,3,1);
CCC:=(B/2+40)*1.1;
DA:=SMA(CCC,3,1);
DRAWICON(CROSS(DA,RSI5),H*1.02,15);
DRAWTEXT(CROSS(DA,RSI5),H*1.03,' ↙短逃');
DRAWICON(CROSS(80,RSI5),H*1.05,14);
DRAWTEXT(CROSS(80,RSI5),H*1.06,' ↙快逃');
TYP:=(HIGH+LOW+CLOSE)/3;
CCI:=(TYP-MA(TYP,14))/(0.015*AVEDEV(TYP,14));
CCIA:=EMA(EMA(EMA(CCI,2),2),2);
CCIB:=EMA(EMA(EMA(CCI,3),2),2);
X:=(CROSS(CCIA,CCIB) OR (CCIA>=CCIB))
AND CCIA>=-101 AND CCIA>=REF(CCIA,1)
AND REF(CCIA,1)<-101 ;
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;
J1:= EMA(EMA(EMA(J,2),2),2);
Y:= J1>REF(J1,1) ;
预警:=X AND Y ;
DRAWICON(预警,(LOW * 0.98),13);
DRAWTEXT(预警,(LOW * 0.97),'↖买')COLORYELLOW;
MA20:MA(CLOSE,20),COLORFFFF00,LINETHICK3;
IF(MA20>=REF(MA20,1),MA20,DRAWNULL),COLOR00FFFF,LINETHICK3;
IF(REF(MA20,1)>MA20,MA20,DRAWNULL),COLORFF0000,LINETHICK3;
JXJ:=ATAN((MA(C,20)/REF(MA(C,20),1)-1)*100)*180/3.1416>=20;
IF(JXJ,MA20,DRAWNULL),COLOR0000FF,LINETHICK3;
RSVB:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
KB:=SMA(RSVB,3,1);
DB:=SMA(KB,3,1),COLORFFFF00,LINETHICK2;
JB:=3*KB-2*DB,COLOR00FF00,LINETHICK2;
EEB:=STICKLINE(DB>=REF(DB,1) AND JB>=REF(JB,1),12,22,4,0),COLORRED;
FFB:=STICKLINE(DB>=REF(DB,1) AND JB<REF(JB,1),12,22,4,0),COLORFF00FF;
GGB:=C>=差;
TT:=IF(ISLASTBAR,240/FROMOPEN,1);
NN:=120;
HH:=HHV(V*TT,NN);
LL:=LLV(V,NN);
最高:=CONST(HH);
最低:=CONST(LL);
最高2:=CONST(HHV(H,NN));
最低2:=CONST(LLV(L,NN));
PP:=IF((最高2*0.9-(最高2-最低2)*0.5)>CONST(LLV(L,20)),0.9,IF((最高2*0.9-(最高2-最低2)*0.5)>CONST(LLV(L,50)),0.7,0.6)),NODRAW;
RCC1:=最高2*0.9-(最高2-最低2)*PP;
最低3:=MIN(RCC1,最低2);
AAD:=最低3;
STICKLINE(1,AAD-0.000*AAD,AAD-0.030*AAD,4,1),COLOR696969;
STICKLINE(1,AAD-0.038*AAD,AAD-0.068*AAD,4,1),COLOR696969;
STICKLINE(EEB,AAD-0.0*AAD,AAD-0.03*AAD,4,0),COLORRED;
STICKLINE(FFB,AAD-0.0*AAD,AAD-0.03*AAD,4,0),COLOR00FF00;
STICKLINE(GGB,AAD-0.038*AAD,AAD-0.068*AAD,4,0),COLOR0000FF;
DRAWTEXT_FIX(1,0.12,0.87,0,'【上彩条--KDJ】★★ 红色--J与D>昨天★★ 绿色--D>昨天,J<昨天★★ ★★【下彩条--差值】★★ 红色--股价>差★★'),COLORFFFF00;