通达信四区决策阶梯主图指标 源码
源码;
{1这部分含未来,注意}
VAR3:=LLV(HIGH,240);
VAR4:=100*(CLOSE-VAR3)/VAR3;
VAR5:=(CLOSE-LLV(LOW,528))/(HHV(HIGH,528)-LLV(LOW,528))*100;
VAR6:=(CLOSE-LLV(CLOSE,530))/(HHV(CLOSE,530)-LLV(CLOSE,530))*100;
VAR7:=0;
VAR8:=SMA(MAX(CLOSE-REF(CLOSE,1),0),34,1)/SMA(ABS(CLOSE-REF(CLOSE,1)),7,1)*100;
VAR9:=SMA(MAX(CLOSE-REF(CLOSE,1),0),13,1)/SMA(ABS(CLOSE-REF(CLOSE,1)),13,1)*100;
VAR10:=IF(TROUGHBARS(3,16,1)=0 AND HIGH>LOW+0.04,4,0);
VAR11:=ZIG(3,6)>REF(ZIG(3,6),1) AND REF(ZIG(3,6),1)<=REF(ZIG(3,6),2) AND REF(ZIG(3,6),2)<=REF(ZIG(3,6),3);
VAR12:=ZIG(3,6)<REF(ZIG(3,6),1) AND REF(ZIG(3,6),1)>=REF(ZIG(3,6),2) AND REF(ZIG(3,6),2)>=REF(ZIG(3,6),3);
VAR13:=ZIG(3,22)>REF(ZIG(3,22),1) AND REF(ZIG(3,22),1)<=REF(ZIG(3,22),2) AND REF(ZIG(3,22),2)<=REF(ZIG(3,22),3);
VAR14:=ZIG(3,22)<REF(ZIG(3,22),1) AND REF(ZIG(3,22),1)>=REF(ZIG(3,22),2) AND REF(ZIG(3,22),2)>=REF(ZIG(3,22),3);
VAR15:=ZIG(3,51)>REF(ZIG(3,51),1) AND REF(ZIG(3,51),1)<=REF(ZIG(3,51),2) AND REF(ZIG(3,51),2)<=REF(ZIG(3,51),3);
VAR16:=ZIG(3,51)<REF(ZIG(3,51),1) AND REF(ZIG(3,51),1)>=REF(ZIG(3,51),2) AND REF(ZIG(3,51),2)>=REF(ZIG(3,51),3);
VAR17:=ZIG(3,72)>REF(ZIG(3,72),1) AND REF(ZIG(3,72),1)<=REF(ZIG(3,72),2) AND REF(ZIG(3,72),2)<=REF(ZIG(3,72),3);
VAR18:=ZIG(3,72)<REF(ZIG(3,72),1) AND REF(ZIG(3,72),1)>=REF(ZIG(3,72),2) AND REF(ZIG(3,72),2)>=REF(ZIG(3,72),3);
VAR19:=EMA(CLOSE,2)-EMA(CLOSE,150);
买1:=VAR10;
买2:=(VAR11+VAR13+VAR15+VAR17);
卖1:=(VAR12+VAR14+VAR16+VAR18);
B:IF(买1>0 OR 买2>0,LOW*0.99,DRAWNULL),CROSSDOT,LINETHICK3,COLORYELLOW;
DRAWTEXT(买1>0 OR 买2>0,LOW*0.98,'W买'),COLORFFFF00;
S:IF(卖1>0,HIGH*1.01,DRAWNULL),CROSSDOT,LINETHICK3,COLORGREEN;
DRAWTEXT(卖1>0,HIGH*1.02,'W快卖'),COLORGREEN;
DRAWICON((ZIG(3,5)>REF(ZIG(3,5),1)) AND (REF(ZIG(3,5),1)<=REF(ZIG(3,5),2)) AND (REF(ZIG(3,5),2)<=REF(ZIG(3,5),3)),LOW*0.98,23) ;
DRAWICON((ZIG(3,5)<REF(ZIG(3,5),1)) AND (REF(ZIG(3,5),1)>=REF(ZIG(3,5),2)) AND (REF(ZIG(3,5),2)>=REF(ZIG(3,5),3)),HIGH*1.01,14);
{2部分}
高1:=REF(HHV(H,120),3);
低1:=REF(LLV(L,120),3);
H1:=高1-(高1-低1)*0.191;
H2:=高1-(高1-低1)*0.382;
H3:=高1-(高1-低1)*0.5;
H4:=高1-(高1-低1)*0.618;
H5:=高1-(高1-低1)*0.809;
突破:=REF(EMA(C,14),1);
A1X:=(EMA(C,10)-突破)/突破*100;
JZ:=IF(A1X>=0,REF(EMA(C,10),BARSLAST(CROSS(A1X,0))+1),REF(EMA(C,10),BARSLAST(CROSS(0,A1X))+1)),COLORFFFF00,LINETHICK2;
N1:=100;
KD:=BARSLAST(CURRBARSCOUNT=N1);
GD:=CONST(IF(ISLASTBAR=1,HHV(H,KD),0));
DD:=CONST(IF(ISLASTBAR=1,LLV(L,KD),0));
KJ:=GD-DD;
GD4:=IF(CURRBARSCOUNT<=N1/2,GD,DRAWNULL);
DRAWBAND(GD4,RGB(0,200,240),DD+KJ/2,RGB(0,0,0));{该行设置背景色}
ND:=IF(BARSCOUNT(C)>=8,8,BARSCOUNT(C));
AMOV:=VOL*(C+L+H)/3;
MN:=SUM(AMOV,ND)/SUM(VOL,ND);
STICKLINE(A1X>=0,JZ,突破,5,0),COLOR9400D3;
STICKLINE(A1X<0,JZ,突破,5,0),COLOR00CED1;
AAC:=CROSS(A1X,0),LINETHICK0;
BBC:=CROSS(0,A1X),LINETHICK0;
DRAWICON(AAC,JZ*0.98,34);
DRAWICON(BBC,JZ*1.015,35);
LC:= REF(CLOSE,1);
RSI:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;
逃顶:=CROSS(82,RSI);
DRAWICON( 逃顶,H*1.01,15);
DRAWTEXT( 逃顶,H*1.01,' ←快跑'),COLORFFFFFF;
平衡:=IF(CURRBARSCOUNT<=N1,DD+KJ/2,DRAWNULL),COLOR00FFFF,NODRAW;
压力:=IF(CURRBARSCOUNT<=N1,GD-KJ*0.191,DRAWNULL),COLORFF00FF,NODRAW;
支撑:=IF(CURRBARSCOUNT<=N1,DD+KJ*0.191,DRAWNULL),COLOR00FF00,NODRAW;
高区:IF(CURRBARSCOUNT<=N1,GD,DRAWNULL),COLORRED,DOTLINE;
低区:IF(CURRBARSCOUNT<=N1,DD,DRAWNULL),COLOR00FF00,DOTLINE;
A1:=BARSLAST(MONTH!=REF(MONTH,1))+1;
月±%:(CLOSE/REF(CLOSE,A1)-1)*100,COLOR00FFFF,NODRAW;
STICKLINE(CURRBARSCOUNT=N1,GD,DD,0,-1),COLORWHITE;
STICKLINE(CURRBARSCOUNT=N1/2,GD,DD,0,-1),COLORWHITE;
STICKLINE(CURRBARSCOUNT=1,GD,DD,0,-1),COLORWHITE;
STICKLINE(CURRBARSCOUNT<=N1,平衡,平衡,3,-1),COLORWHITE;
STICKLINE(CURRBARSCOUNT<=N1/2,压力,压力,3,-1),COLORRED;
STICKLINE(CURRBARSCOUNT<=N1/2,支撑,支撑,3,-1),COLORGREEN;
DRAWKLINE(H,O,L,C);
DRAWTEXT(CURRBARSCOUNT=1,压力,'0.809'),COLOR0000FF;
DRAWTEXT(CURRBARSCOUNT=1,平衡,'0.500'),COLORFFFFFF;
DRAWTEXT(CURRBARSCOUNT=1,支撑,'0.191'),COLOR00FFFF;
DRAWTEXT(CURRBARSCOUNT=N1/2-10,GD-KJ/12,'★★强势区域--急拉减仓★★'),COLOR00FFFF;
DRAWTEXT(CURRBARSCOUNT=N1/2-10,GD-KJ/3,'★★震荡整理--寻机低吸★★'),COLOR00FFFF;
DRAWTEXT(CURRBARSCOUNT=N1/2-10,DD+KJ/3,'★★反弹中轨--逢高休息★★'),COLORFFFF00;
DRAWTEXT(CURRBARSCOUNT=N1/2-10,DD+KJ/10,'★★弱势区域--暂不参与★★'),COLORFFFF00;
C1:=C>=JZ;
C2:=C<JZ;
AA:=C1>=C2 ;
BB:=C2>C1 ;
STICKLINE(AA,C,O,3,0),COLORRED;
STICKLINE(AA,H,L,0,0),COLORRED;
STICKLINE(BB,C,O,3,0),COLOR00FF00;
STICKLINE(BB,H,L,0,0),COLOR00FF00;
{红}
STICKLINE(AA,CLOSE,OPEN,3,0),COLOR000099;
STICKLINE(AA,CLOSE,OPEN,2.2,0),COLOR0000CC;
STICKLINE(AA,CLOSE,OPEN,1.5,0),COLOR0000FF;
STICKLINE(AA,CLOSE,OPEN,0.5,0),COLORCC66FF;
{蓝}
STICKLINE(BB,CLOSE,OPEN,3,0),COLORFF7700;
STICKLINE(BB,CLOSE,OPEN,2.2,0),COLORFF9900;
STICKLINE(BB,CLOSE,OPEN,1.5,0),COLORFFBB00;
STICKLINE(BB,CLOSE,OPEN,0.5,0),COLORCYAN;
MN1:SUM(AMOV,ND)/SUM(VOL,ND),COLORFF0000,LINETHICK3;
NOTEXT1:IF(C>MN1,MN1,DRAWNULL),LINETHICK3,COLOR0000FF;
NOTEXT2:IF(C<MN1,MN1,DRAWNULL),LINETHICK3,COLOR00FFFF;
AAA:= C>MN;
BBB:= C<MN;
DDD:= A1X>=0;
EE:= A1X<0;
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(AAA,AAD-0.000*AAD,AAD-0.030*AAD,4,0),COLORRED;
STICKLINE(BBB,AAD-0.005*AAD,AAD-0.025*AAD,4,0),COLOR00DDDD;
STICKLINE(DDD,AAD-0.035*AAD,AAD-0.065*AAD,4,0),COLORDD00DD;
STICKLINE(EE,AAD-0.040*AAD,AAD-0.060*AAD,4,0),COLORAAAAAA;
DRAWTEXT_FIX(1,0.3,0.87,0,'★★[上] 红色--决策短线持股★★★★[下] 粉色--梯形彩块持股★★'),COLORFFFFFF ;