涨跌互现(源码)
DRAWGBK(1,COLORRGB(100,100,100),COLORRGB(50,50,50),1);
{涨跌互现}
hh:=SYSPARAM(4); ll:=SYSPARAM(5);//对应画面空间
DC:=INDEXC,LINETHICK;
GGS:=BARSCOUNT(C);
Var1:=ZIG(4,15);//个股
GS1:=PEAKBARS(4,15,1);
Var2:=FLATZIG(DC,15);//大盘
PS1:=PEAKBARS(DC,15,1);
XX:=Var1
YY:=Var2
FILLRGN(XX,hh,ll),COLOR08683C,color4400;
FILLRGN(NOT(XX),hh,ll),COLORE3C3F3;
{涨跌互现}
股峰:PEAK(4,15,1),LINETHICK;F1:=STRTONUM(NUMTOSTR(GGS-BARSSINCE(股峰),0));
股谷:TROUGH(4,15,1),LINETHICK;G1:=STRTONUM(NUMTOSTR(GGS-BARSSINCE(股谷),0));
大盘峰:PEAK(DC,15,1),LINETHICK;DF:=STRTONUM(NUMTOSTR(GGS-BARSSINCE(大盘峰),0));
大盘谷:TROUGH(DC,15,1),LINETHICK;DG:=STRTONUM(NUMTOSTR(GGS-BARSSINCE(大盘谷),0));
个股:Var1,COLOR00DDFF,LINETHICK2,COLORYELLOW;
大盘:LL+Var2*(HH-LL),COLORFFAF00,LINEDOT;
WF:=GGS
WDF:=GGS
IF WGS[SYSPARAM(1)] AND WFS[SYSPARAM(1)] AND WF[SYSPARAM(1)]=0 AND WG[SYSPARAM(1)]=0 THEN
DRAWTEXT(SYSPARAM(2)=BARPOS,LL,'个股涨幅(%):'+ NUMTOSTR((个股[SYSPARAM(1)]/IF(NOT(XX[SYSPARAM(1)]),股谷[SYSPARAM(1)],IF(BARSCOUNT(C)
DRAWTEXT(SYSPARAM(2)=BARPOS,LL,'个股涨幅(%):'+NUMTOSTR((个股[SYSPARAM(1)]/个股[1]-1)*100,2)),COLOR0000FF,PXUP30;
IF WDGS[SYSPARAM(1)] AND WDFS[SYSPARAM(1)] AND WDF[SYSPARAM(1)]=0 AND WDG[SYSPARAM(1)]=0 THEN
DRAWTEXT(SYSPARAM(2)=BARPOS,LL,'大盘涨幅(%):'+NUMTOSTR((DC[SYSPARAM(1)]/IF(NOT(YY[SYSPARAM(1)]),大盘谷[SYSPARAM(1)],大盘峰[SYSPARAM(1)])-1)*100,2)),COLOR3595FF;
ELSE
DRAWTEXT(SYSPARAM(2)=BARPOS,LL,'大盘涨幅(%):'+NUMTOSTR((DC[SYSPARAM(1)]/DC[1]-1)*100,2)),COLOR3595FF;
IF WGS[SYSPARAM(1)] AND WFS[SYSPARAM(1)] AND WF[SYSPARAM(1)]=0 AND WG[SYSPARAM(1)]=0 THEN
DRAWNUMBER(GS1=0,HH,(股峰/股谷-1)*100,2),COLOR0033FF;
ELSE
DRAWNUMBER(GS1=0,HH,(股峰/个股[1]-1)*100,2),COLOR0033FF;
IF WDGS[SYSPARAM(1)] AND WDFS[SYSPARAM(1)] AND WDF[SYSPARAM(1)]=0 AND WDG[SYSPARAM(1)]=0 THEN
DRAWNUMBER(PS1=0,HH,(大盘峰/大盘谷-1)*100,2),COLOR3595FF,PXDN25;
ELSE
DRAWNUMBER(PS1=0,HH,(DC/DC[1]-1)*100,2),COLOR3595FF,PXDN25;
DRAWNUMBER(ISLASTBAR AND NOT(XX),HH,(CLOSE/股谷-1)*100,2),COLORFF00FF;
KLINE(O,H,L,C,0);
{数浪公式}
GET:=ZIG(4,10),COLORYELLOW;
PL5:=ZIG(3,5);
EN1:=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);
EX1:=ZIG(3,5)=REF(ZIG(3,5),2) AND REF(ZIG(3,5),2)>=REF(ZIG(3,5),3);
PL10:=ZIG(3,10);
EN2:=ZIG(3,10)>REF(ZIG(3,10),1) AND REF(ZIG(3,10),1)<=REF(ZIG(3,10),2) AND REF(ZIG(3,10),2)<=REF(ZIG(3,10),3);
EX2:=ZIG(3,10)=REF(ZIG(3,10),2) AND REF(ZIG(3,10),2)>=REF(ZIG(3,10),3);
PL20:=ZIG(3,20);
EN3:=ZIG(3,20)>REF(ZIG(3,20),1) AND REF(ZIG(3,20),1)<=REF(ZIG(3,20),2) AND REF(ZIG(3,20),2)<=REF(ZIG(3,20),3);
EX3:=ZIG(3,20)=REF(ZIG(3,20),2) AND REF(ZIG(3,20),2)>=REF(ZIG(3,20),3);
PL40:=ZIG(3,40);
走强1:=BARSLAST(PL5
走弱1:=BARSLAST(PL5>REF(PL5,1));
走强2:=BARSLAST(PL10
走弱2:=BARSLAST(PL10>REF(PL10,1));
走强3:=BARSLAST(PL20
走弱3:=BARSLAST(PL20>REF(PL20,1));
ZTJZ5:=IF(PL10>REF(PL10,1),COUNT(EN1,走强2),0);
ZTJD5:=IF(PL10>REF(PL10,1),COUNT(EX1,走强2),0);
DTJZ5:=IF(PL10
DTJD5:=IF(PL10
ZTJZ10:=IF(PL20>REF(PL20,1),COUNT(EN2,走强3),0);
ZTJD10:=IF(PL20>REF(PL20,1),COUNT(EX2,走强3),0);
DTJZ10:=IF(PL20
DTJD10:=IF(PL20
DRAWTEXT(EN1 AND DTJZ5=1,L*0.98,'(A)'),COLORFFFF00,align0,linethick10;
DRAWTEXT(EX1 AND DTJD5=2,H*1.02,'(B)'),COLORFF00FF,align0,linethick10;
DRAWTEXT(EN2 AND ZTJZ5=1,L*0.98,'(C)'),COLOR0000FF,align0,linethick10;
DRAWTEXT(EX1 AND PL10>REF(PL10,1) AND ZTJD5=1,H*1.03,'⑴'),COLOR0000FF,align0,linethick5;
DRAWTEXT(EN1 AND PL10>REF(PL10,1) AND ZTJZ5=2,L*0.97,'⑵'),COLOR0000FF,align0,linethick5;
DRAWTEXT(EX1 AND PL10>REF(PL10,1) AND ZTJZ5=2,H*1.03,'⑶'),COLOR0000FF,align0,linethick5;
DRAWTEXT(EN1 AND PL10>REF(PL10,1) AND ZTJZ5=3,L*0.97,'⑷'),COLOR0000FF,align0,linethick5;
DRAWTEXT(EX2 AND PL20>REF(PL20,1) AND ZTJD10=1,H*1.03,'⑸'),COLOR0000FF,align0,linethick5;
DRAWTEXT(EN2 AND DTJZ10=1,L*0.96,'Ⅰ'),COLORFF00FF,align0,linethick5;
DRAWTEXT(EX2 AND DTJD10=2,H*1.04,'Ⅱ'),COLORFFFF00,align0,linethick5;
DRAWTEXT(EN3 AND ZTJZ10=1,L*0.96,'Ⅲ'),COLOR0000FF,align0,linethick5;
DRAWTEXT(EX2 AND PL20>REF(PL20,1) AND ZTJD10=1,H*1.03,'①'),COLOR00FFFF,align0,linethick5;
DRAWTEXT(EN2 AND PL20>REF(PL20,1) AND ZTJZ10=2,L*0.97,'②'),COLOR00FFFF,align0,linethick5;
DRAWTEXT(EX2 AND PL20>REF(PL20,1) AND ZTJD10=2 OR (ZTJD10=0 OR ZTJD10=2) AND EX2,H*1.03,'③'),COLOR00FFFF,align0,linethick5;
DRAWTEXT(EN2 AND PL20>REF(PL20,1) AND ZTJZ10=3,L*0.97,'④'),COLOR00FFFF,align0,linethick5;