0001--主图显示代码及板块
一、显示板块
例一:
DRAWTEXT(BARPOS=SYSPARAM(2),H,'\N所属板块:'+BLKNAME),ALIGN4,COLORYELLOW;
例二:
DRAWTEXT(SYSPARAM(2)=BARPOS,C,'所属板块:'+BLKNAME),ALIGN4,COLORYELLOW;
例三:
DRAWTEXT(SYSPARAM(2)=BARSCOUNT(C),H,'[所属版块]:'+BLKNAME),ALIGN4,COLORYELLOW;
二、显示代码及板块
S:=STKLABEL;
DRAWTEXT(SYSPARAM(2)=BARPOS,C,S),ALIGN4,COLORYELLOW;
DRAWTEXT(BARPOS=SYSPARAM(2),H,'\N 所属板块:'+BLKNAME),ALIGN4,COLORYELLOW;{N与所属板块之间空六格,以显示代码}
0031--均线多头排列
A1:=MA(C,N1);
A2:=MA(C,N2);
A3:=MA(C,N3);
A4:=MA(C,N4);
COUNT(A1>A2 AND A2>A3 AND A3>A4,3);
0032--均线空头排列
A1:=MA(C,N1);
A2:=MA(C,N2);
A3:=MA(C,N3);
A4:=MA(C,N4);
COUNT(A1< A2 AND A2< A3 AND A3< A4,3);
0033--N日均线向下
AA:=MA(C,N);
BB:=REF(AA,1);
AA< BB
0034--N日均线向上
AA:=MA(C,N);
BB:=REF(AA,1);
AA>BB
0035--N日均线走平
AA:=MA(C,N);
BB:=REF(AA,1);
AA=BB
0036--向前N日至M日出现过均线死叉(P1< P2)
AA:=MA(C,P1);
BB:=MA(C,P2);
CC:=REF(CROSS(BB,AA),N);
COUNT(CC,M);
0037--今日成交量大于N日以来的均量
VOL>MA(VOL,N);
0038--低位密集
A1:=COST(85);
A2:=COST(15);
A3:=A1-A2;
A4:=(A1+A2)/2;
A5:=A3/A4*100<10;
B1:=HHV(H,120);
B2:=LLV(L,120);
B3:=B1-B2;
B4:=(A4-B2)< B3/2;
A5 AND B4;
0039--换手率
VOL/CAPITAL*100;
0040--N日盈亏
V1:=VOL/SUM(VOL,N);
V2:=DMA(CLOSE,V1);
V3:(CLOSE-V2)/V2*100;
0041--曲线叠加
指标线的叠加,是为了方便观看和比较,没什么其他的意义。
一、对指标曲线的变化幅度放大
此法,一线变形,另一线不变,但变形线的走势与原线完全相似。
举例:C叠加V
BC:=HHV(C,N)-LLV(C,N);//N一般取常用主图上的K线数量
BV:=HHV(V,N);
BI:=BC/BV;//叠加比
B:=BI[DATACOUNT];//最后一根K线的叠加比,保证叠加比前后统一
成交量:V,VOLSTICK;
F:=C/REF(C,1);
JC:=REF(C,1)*(1+A*F)*B/A;//A-放大倍数,将C的涨跌幅度F放大
JL:=LLV(JC,N);//平移量。请去掉JC句的=看JL的作用
收盘价:C,LINETHICK0,COLORYELLOW;//只显示数值,不画线
PARTLINE(C>0,JC-JL[DATACOUNT]),COLORYELLOW;//收盘价趋势线,只画线,不显示数值
通式:
曲线X叠加曲线Y
BX:=HHV(X,N)-LLV(X,N);
BY:=HHV(Y,N)-LLV(Y,N);
BI:=BX/BY;
B:=BI[DATACOUNT];
FX:=X/REF(X,1);
JX:=REF(X,1)*(1+A*FX)*B/A;
XL:=LLV(JX,N);
曲线Y:Y;
曲线X:X,LINETHICK0;//曲线X的值
PARTLINE(C,JX-XL[DATACOUNT]);//曲线X的线
二、百分比叠加
把两曲线的波动幅度划成百分比进行叠加
此法,两线都变形,但走势都与原线完全相似。
举例:C叠加V
HV:=HHV(V,N);
DV:=HV[DATACOUNT];
BV:=100/DV;
V*BV,VOLSTICK;
HC:=HHV(C,N);
LC:=LLV(C,N);
BC:=100/(HC[DATACOUNT]-LC[DATACOUNT]);
(C-LC[DATACOUNT])*BC;
通式一:
曲线X,曲线Y
XH:=HHV(X,N);
XL:=LLV(X,N);
XDH:=XH[DATACOUNT];
XDL:=XL[DATACOUNT];
BX:=100/(XDH-XDL);
曲线X:(X-XDL)*BX;
YH:=HHV(Y,N);
YL:=LLV(Y,N);
YDH:=YH[DATACOUNT];
YDL:=YL[DATACOUNT];
BY:=100/(YDH-YDL);
曲线Y:(Y-YDL)*BY;
通式二:
X曲线+Y曲线
N:=SYSPARAM(3)-SYSPARAM(2);
X:=.........; {.........为X曲线定义}
XH:=HHV(X,N);
XL:=LLV(X,N);
XDH:=XH[SYSPARAM(3)];
XDL:=XL[SYSPARAM(3)];
BX:=100/(XDH-XDL);
曲线X:(X-XDL)*BX;
Y:=.........;{.........为Y曲线定义}
YH:=HHV(Y,N);
YL:=LLV(Y,N);
YDH:=YH[SYSPARAM(3)];
YDL:=YL[SYSPARAM(3)];
BY:=100/(YDH-YDL);
曲线Y:(Y-YDL)*BY;
三、固定位置叠加
此法应用不多,仅举例。
例一:
主图成交量(V叠加C)
{M:960,1,2000}
R0:=M/1000;R:=(L-R0*SYSPARAM(5))/V;
R1:=LLV(R,SYSPARAM(3)-SYSPARAM(2));R2:=R1[SYSPARAM(3)];
R3:=LLV(L-R2*V,SYSPARAM(3)-SYSPARAM(2));
R4:=R3[SYSPARAM(3)];R5:=(R2*V+R4)*0.995;
STICKLINE(C>=REF(C,1),R5,R0*SYSPARAM(5),6,1)COLORRED;
STICKLINE(C< REF(C,1),R5,R0*SYSPARAM(5),6,0)COLORCYAN;
PARTLINE(V>=0,R0*SYSPARAM(5)) COLORWHITE;
PARTLINE(R5>0,MA(R5,5));
PARTLINE(R5>0,MA(R5,10));
PARTLINE(R5>0,MA(R5,20));
例二:
INPUT:N(10,2,999);
M:=SYSPARAM(3)-SYSPARAM(2);
X:=C;
Y:=SUM(IF(CLOSE>REF(CLOSE,1),VOL/CAPITAL,IF(CLOSE< REF(CLOSE,1),-VOL/CAPITAL,0)),0);
XH:=HHV(X,M); XL:=LLV(X,M); XDH:=XH[SYSPARAM(3)]; XDL:=XL[SYSPARAM(3)];
BX:=100/(XDH-XDL);
收盘:C,LINETHICK0,;
收盘↑:PARTLINE(X>REF(X,1),(X-XDL)*BX),COLORRED;
收盘↓:PARTLINE(X< REF(X,1),(X-XDL)*BX),COLORCYAN;
YH:=HHV(Y,M); YL:=LLV(Y,M); YDH:=YH[SYSPARAM(3)]; YDL:=YL[SYSPARAM(3)];
BY:=100/(YDH-YDL);
TY:=(Y-YDL)*BY;
OBV值:Y*1000,LINETHICK0,COLOR007BFF;
OBV线↑:PARTLINE(Y>REF(Y,1),(Y-YDL)*BY),COLORYELLOW;
OBV线↓:PARTLINE(Y< REF(Y,1),(Y-YDL)*BY),COLOR009F00;
A1:=REF(TY,N)=HHV(TY,2*N+1); B1:=FILTER(A1,N); C1:=BACKSET(B1,N+1); HD:=FILTER(C1,N);
A2:=REF(TY,N)=LLV(TY,2*N+1); B2:=FILTER(A2,N); C2:=BACKSET(B2,N+1); LD:=FILTER(C2,N);
AA:=REF(TY,BARSLAST(HD)); BB:=REF(TY,BARSLAST(LD));A1:=REF(Y,BARSLAST(HD))*1000; B1:=REF(Y,BARSLAST(LD))*1000;
T1:=BARSLAST(HD)< BARSLAST(LD) AND NOT(HD) ;
T2:=BARSLAST(HD)>BARSLAST(LD) AND NOT(LD);
PARTLINE(T1,AA),COLORMAGENTA,LINETHICK2;
PARTLINE(T2,BB),COLORGREEN,LINETHICK2;
DRAWNUMBER(T1=0 AND REF(T1,1)>0,REF(AA,1)+0.1,A1,2);
DRAWNUMBER(T2=0 AND REF(T2,1)>0,REF(BB,1)+0.1,B1,2);
DRAWNUMBER(ISLASTBAR AND T1>0,REF(AA,1)+0.1,A1,2),COLORYELLOW;
DRAWNUMBER(ISLASTBAR AND T2>0,REF(BB,1)+0.1,B1,2),COLORMAGENTA;
0042--均线变色
MA05:MA(CLOSE,5);
MA30:MA(CLOSE,30);
IF(MA05< MA30,MA05,MA30),COLORGREEN;
IF(MA05< MA30,MA30,MA05),COLORRED;
IF(MA05>MA30,MA30,MA30),COLORBLUE;
DRAWICON(CROSS(MA