--主图显示代码及板块
一、显示板块
例一:
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(MA05,MA30),L*0.98,4);
DRAWICON(CROSS(MA30,MA05),H*1.02,5);
0055--底背离
LLV(L,60)=L) AND NOT(LLV(DEA,60)=DEA);
0056--顶背离
HHV(H,60)=H) AND NOT(HHV(DEA,60)=DEA);
0057--N次金叉、死叉
0轴上二次金叉
COUNT(CROSS(DIF,DEA) AND DEA>0,20)=2 AND CROSS(DIF,DEA) AND
DEA>0;
0轴上三次金叉
COUNT(CROSS(DIF,DEA) AND DEA>0,20)=3 AND CROSS(DIF,DEA) AND
DEA>0;
0轴上四次金叉
COUNT(CROSS(DIF,DEA) AND DEA>0,20)=4 AND CROSS(DIF,DEA) AND DEA>0;
二次金叉
EXPLAIN(COUNT(CROSS(DIF,DEA),20)=2 AND CROSS(DIF,DEA);
二次死叉
COUNT(CROSS(DEA,DIF),20)=2 AND CROSS(DEA,DIF);
0058--5分钟副图显示15分钟K线
建公式:0015
C15:CLOSE;
O15:OPEN;
H15:HIGH;
L15:LOW;
建公式:十五K线
C15:="0015.C15#MIN15";
O15:="0015.O15#MIN15";
H15:="0015.H15#MIN15";
L15:="0015.L15#MIN15";
TI:=OPENMINUTES(TIME)=10 OR OPENMINUTES(TIME)=25 OR OPENMINUTES(TIME)=40 OR OPENMINUTES(TIME)=55 OR OPENMINUTES(TIME)=70 OR OPENMINUTES(TIME)=85 OR OPENMINUTES(TIME)=100 OR OPENMINUTES(TIME)=115 OR OPENMINUTES(TIME)=130 OR OPENMINUTES(TIME)=145 OR OPENMINUTES(TIME)=160 OR OPENMINUTES(TIME)=175 OR OPENMINUTES(TIME)=190 OR OPENMINUTES(TIME)=205 OR OPENMINUTES(TIME)=220 OR OPENMINUTES(TIME)=235;
HH15:=IF(TI,H15,C15);
LL15:=IF(TI,L15,C15);
STICKLINE(C15>O15,C15,O15,10,0),COLORRED;
STICKLINE(C15>O15 AND H15>C15,HH15,C15,0.1,0),COLORRED;
STICKLINE(C15>O15 AND O15>L15,O15,LL15,0.1,0),COLORRED;
STICKLINE(C15<=O15,C15,O15,10,0),COLORGREEN;
STICKLINE(C15L15,C15,LL15,0.1,0),COLORGREEN;
STICKLINE(C15O15,HH15,O15,0.1,0),COLORGREEN;
注:以大陆股市为例,四小时,其他市场如超过四小时,可在中间语句“TI:=”中以15为系数顺序加足,如:OR 250 OR 265……等等。
0059--移动成本
不知道函数算法,计算误差在所难免。调整参数“%”可看到不同的移动成本。
///筹码%
INPUT:%(90,1,100);
A:=AMOUNT/V/100;
成本:FLOOR(COST(50-%/2)*100)/100,COLORYELLOW,LINETHICK0;
~:CEILING(COST(50+%/2)*100)/100,COLORYELLOW,LINETHICK0;
集中度:INTPART((~-成本)/(~+成本)*1000)/10,COLORGREEN;
平均成本:ROUND(COST(50)*100)/100,LINETHICK0;
穿透力:(WINNER(C)-REF(WINNER(C),1))/V*CAPITAL,LINETHICK0;//计算误差大
//穿透力2:(WINNER(C)-WINNER(O))/V*CAPITAL,LINETHICK0;//这一写法还是误差大
获利比例:ROUND(WINNER(C)*1000)/10,LINETHICK0;
精彩评论