四区对比大盘主图指标源码:
N:=120;
K:=BARSLAST(CURRBARSCOUNT=N);
GD:=CONST(IF(ISLASTBAR=1,HHV(H,K),0)); DD:=CONST(IF(ISLASTBAR=1,LLV(L,K),0));
KJ:=GD-DD;
GD4:IF(CURRBARSCOUNT<=N/10,GD,DRAWNULL);
平衡:IF(CURRBARSCOUNT<=N/10,DD+KJ/2,DRAWNULL),COLORFFFFFF;
压力:IF(CURRBARSCOUNT<=N/10,GD-KJ*0.191,DRAWNULL),COLORFFFFFF;
支撑:IF(CURRBARSCOUNT<=N/10,DD+KJ*0.191,DRAWNULL),COLOR00FF00;
高:IF(CURRBARSCOUNT<=N/10,GD,DRAWNULL),COLOR00FFFF;
低:IF(CURRBARSCOUNT<=N/10,DD,DRAWNULL),COLOR00FF00;
低涨:IF(CURRBARSCOUNT<=N/10,(C/LLV(LOW,K)-1)*100,DRAWNULL),COLOR0000FF,NODRAW;
天数:BARSLAST(L=DD),COLORCYAN,NODRAW;
DRAWBAND(高,RGB(160,160,0),压力,RGB(0,0,0));
DRAWBAND(压力,RGB(130,0,0),平衡,RGB(0,0,0));
DRAWBAND(平衡,RGB(130,0,130),支撑,RGB(0,0,0));
DRAWBAND(支撑,RGB(150,150,150),低,RGB(0,0,0));
STICKLINE(CURRBARSCOUNT<=N/10,平衡,平衡*0.998,4,0),COLORWHITE;
STICKLINE(CURRBARSCOUNT<=N/10,压力,压力*0.998,4,0),COLOR00FFFF;
STICKLINE(CURRBARSCOUNT<=N/10,支撑,支撑*0.998,4,0),COLOR00FF00;
STICKLINE(CURRBARSCOUNT<=N/10,低,低,4,0),COLORGREEN;
PV:=INDEXV;
LB1:=V/REF(MA(V,3),1);
LB2:=PV/REF(MA(PV,3),1);
A1:=LB1>LB2;
A2:=LB1<LB2;
A3:=LB1>1.3*LB2 AND LB1<=2*LB2;A4:=LB1>2*LB2;
A5:=LB2>1.3*LB1 AND LB2<=2*LB1;A6:=LB2>2*LB1;
AA:=LB1>1.10*LB2;
低于大盘:=STICKLINE(A2,H,L,0,0),COLORFFFF00;
STICKLINE(A2,O,C,3.2,0),COLOR888800;
STICKLINE(A2,O,C,1.5,0),COLORCCCC00;
STICKLINE(A2,O,C,0.1,0),COLORFFFF00;
弱于大盘:=STICKLINE(A5,H,L,0,0),COLOR00FF00;
STICKLINE(A5,O,C,3.2,0),COLOR008800;
STICKLINE(A5,O,C,1.5,0),COLOR00CC00;
STICKLINE(A5,O,C,0.1,0),COLOR00FF00;
超弱大盘:=STICKLINE(A6,H,L,0,0),COLORFF0000;
STICKLINE(A6,O,C,3.2,0),COLOR880000;
STICKLINE(A6,O,C,1.5,0),COLORCC0000;
STICKLINE(A6,O,C,0.1,0),COLORFF0000;
领先大盘:=STICKLINE(A1,H,L,0,0),COLORFF00FF;
STICKLINE(A1,O,C,3.2,0),COLOR880088;
STICKLINE(A1,O,C,1.5,0),COLORCC00CC;
STICKLINE(A1,O,C,0.1,0),COLORFF00FF;
强于大盘:=STICKLINE(A3,H,L,0,0),COLOR0000FF;
STICKLINE(A3,O,C,3.2,0),COLOR000088;
STICKLINE(A3,O,C,1.5,0),COLOR0000CC;
STICKLINE(A3,O,C,0.1,0),COLOR0000FF;
超强大盘:=STICKLINE(A4,H,L,0,0),COLOR00FFFF;
STICKLINE(A4,O,C,3.2,0),COLOR008888;
STICKLINE(A4,O,C,1.5,0),COLOR00BBBB;
STICKLINE(A4,O,C,0.1,0),COLOR00FFFF;
QQ:=COUNT(AA,6)>=4;
DRAWTEXT(QQ,L-0.1,'→庄←'),COLOR00FFFF;
RSIA1:=SMA(MAX(CLOSE-REF(CLOSE,1),0),3,1)/SMA(ABS(CLOSE-REF(CLOSE,1)),3,1)*100,COLORFFFF00;
ZB1:=RSIA1<20;
买入:DRAWICON(CROSS(RSIA1,20),L*0.98,13);
ZB2:=(ZB1=0 AND RSIA1<=80);
卖出:DRAWICON(ZB2=1 AND REF(ZB2,1)=0 AND 买入=0,H*1.002,14);
N2:=5;
JA1:=REF(H,N2)=HHV(H,2*N2+1);
JB1:=FILTER(JA1,N2);
JC1:=BACKSET(JB1,N2+1);
HD:= FILTER(JC1,N2);
RH:=BACKSET(CURRBARSCOUNT=2,BARSLAST(HD)+1);
SH:=RH>REF(RH,1);
H1:=REF(H ,BARSLAST(SH));
STICKLINE(H1,H1,H1,5,0),LINETHICK2,COLOR00FFFF;
DRAWTEXT(ISLASTBAR,H1*1.005,'近期高点'),COLORFFFF00;
TTP:=(CURRBARSCOUNT=5-4);
DRAWNUMBER(TTP AND H1,H1,H1),COLORFFFF00;
JA2:=REF(L,N2)=LLV(L,2*N2+1);
JB2:=FILTER(JA2,N2);
JC2:=BACKSET(JB2,N2+1);
LD:=FILTER(JC2,N2);
RL:=BACKSET(CURRBARSCOUNT=2,BARSLAST(LD)+1);
SL:=RL>REF(RL,1);
L1:=REF(L ,BARSLAST(SL));
STICKLINE(L1,L1,L1,5,0),COLORFFFF00,LINETHICK5;
DRAWTEXT(ISLASTBAR,L1*1.005,'近期低点'),COLORFFFF00;
DRAWNUMBER(TTP AND L1,L1,L1),COLOR00FFFF;
DRAWTEXT(CURRBARSCOUNT=N/10+12,GD-KJ/12,'【风险区】--高抛避险'),COLOR00FFFF;
DRAWTEXT(CURRBARSCOUNT=N/10+12,GD-KJ/3,'【警示区】--逢高减仓'),COLORFFFFFF;
DRAWTEXT(CURRBARSCOUNT=N/10+12,DD+KJ/3,'【关注区】--逢低买入'),COLOR00FFFF;
DRAWTEXT(CURRBARSCOUNT=N/10+12,DD+KJ/10,'【休整区】--养精畜锐'),COLOR00FF00;
DRAWTEXT_FIX(1,0.05,0.0,0,'【彩色K线】★★黄s--超强大盘★★红色--强于大盘
★★粉色--领先大盘★★青色--低于大盘★★★★绿色--弱于大盘★★蓝色--超弱大盘★★ '),COLORFFFF00; |