源码:
MA5:=EMA(C,5),NOTEXT;//
//DRAWCOLORLINE(MA5 REF(MA5,1),MA5,COLORRED,COLORGREEN),LINETHICK1;//
MA13:EMA(C,13),NOTEXT;//
//DRAWCOLORLINE(MA13 REF(MA13,1),MA13,COLORRED,COLORGREEN),LINETHICK1;//
MA21:EMA(C,21),NOTEXT;//
//DRAWCOLORLINE(MA21 REF(MA21,1),MA21,COLORRED,COLORGREEN),LINETHICK1;//
EMA89:=EMA(C,89),COLORYELLOW,NODRAW,LINETHICK1;//DRAW;
DRAWCOLORLINE(EMA89 REF(EMA89,1),EMA89,COLORRED,COLORGREEN),LINETHICK1;//
//DRAWCOLORLINE(EMA89 REF(EMA89,1),EMA89,COLORYELLOW,COLORYELLOW),LINETHICK1;//纯色白线纯色黄线COLORYELLOW
//定义下面条件用的假设条件
DD:=CROSS(MA5 MA13 MA13 MA21 MA5 REF(MA5,1) MA13 REF(MA13,1) MA21 REF(MA21,1),0.5);//C MA5
KK:=CROSS(MA5 MA13 MA13 MA21 MA5 REF(MA5,1) MA13 REF(MA13,1) MA21 REF(MA21,1),0.5);//
DDD:=DD COUNT(DD,BARSLAST(KK))=1,WORD(0, A ),VALIGN0,FONTSIZE23;
KKK:=KK COUNT(KK,BARSLAST(DD))=1,WORD(1, B ),VALIGN2,FONTSIZE23;
//定义所有的K线都是白色和阴阳
DRAWCOLORKLINE(1,COLORWHITE,1);
DRAWCOLORKLINE(ISDOWN,COLORWHITE,0);
//紫红青色两色K线,这个是全定义为白色,然后反向推出彩色线
DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,DDD),COLORMAGENTA,1);
DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,DDD) ISDOWN,COLORMAGENTA,0);
DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,KKK),COLORCYAN,1);
DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,KKK) ISDOWN,COLORCYAN,0);
//白色区一,还有黄色,白色是顺前势,黄色是要转势,红绿线之上的均线排列
DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,DDD) (MA21 REF(MA21,1) MA13 REF(MA13,1) MA5 MA13||MA21 REF(MA21,1) MA13 REF(MA13,1)),COLORWHITE,1);
DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,DDD) (MA21 REF(MA21,1) MA13 REF(MA13,1) MA5 MA13||MA21 REF(MA21,1) MA13 REF(MA13,1)) ISDOWN,COLORWHITE,0);
DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,DDD) (MA21 REF(MA21,1) MA13 REF(MA13,1) MA13 MA21),COLORYELLOW,1);
DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,DDD) (MA21 REF(MA21,1) MA13 REF(MA13,1) MA13 MA21) ISDOWN,COLORYELLOW,0);
DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,KKK) (MA21 REF(MA21,1) MA13 REF(MA13,1) MA5 MA13||MA21 REF(MA21,1) MA13 REF(MA13,1)),COLORWHITE,1);
DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,KKK) (MA21 REF(MA21,1) MA13 REF(MA13,1) MA5 MA13||MA21 REF(MA21,1) MA13 REF(MA13,1)) ISDOWN,COLORWHITE,0);
DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,KKK) (MA21 REF(MA21,1) MA13 REF(MA13,1) MA13 MA21),COLORYELLOW,1);
DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,KKK) (MA21 REF(MA21,1) MA13 REF(MA13,1) MA13 MA21) ISDOWN,COLORYELLOW,0);
TJ1:=VALUEWHEN(DDD||KKK,DDD) (MA21 REF(MA21,1) MA13 REF(MA13,1) MA5 MA13||MA21 REF(MA21,1) MA13 REF(MA13,1))||
VALUEWHEN(DDD||KKK,KKK) (MA21 REF(MA21,1) MA13 REF(MA13,1) MA5 MA13||MA21 REF(MA21,1) MA13 REF(MA13,1))||
VALUEWHEN(DDD||KKK,DDD) (MA21 REF(MA21,1) MA13 REF(MA13,1) MA13 MA21)||
VALUEWHEN(DDD||KKK,KKK) (MA21 REF(MA21,1) MA13 REF(MA13,1) MA13 MA21);
TJ2:=VALUEWHEN(DDD||KKK,DDD);
DRAWHORIZONTALLINE(TJ2 REF(TJ1,1),C,COLORYELLOW),DOT;
//以收盘价大小 为参考的K线,排除假的阴阳线
//紫红青色两色K线,这个是全定义为白色,然后反向推出彩色线
//DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,DDD),COLORMAGENTA,1);
//DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,DDD) C REF(C,1),COLORMAGENTA,0);
//DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,KKK),COLORCYAN,1);
//DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,KKK) C REF(C,1),COLORCYAN,0);
//白色区一,还有黄色,白色是顺前势,黄色是要转势,以收盘价来比较
//DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,DDD) (MA21 REF(MA21,1) MA13 REF(MA13,1) MA5 MA13||MA21 REF(MA21,1) MA13 REF(MA13,1)),COLORWHITE,1);
//DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,DDD) (MA21 REF(MA21,1) MA13 REF(MA13,1) MA5 MA13||MA21 REF(MA21,1) MA13 REF(MA13,1)) C REF(C,1),COLORWHITE,0);
//DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,DDD) (MA21 REF(MA21,1) MA13 REF(MA13,1) MA13 MA21),COLORYELLOW,1);
//DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,DDD) (MA21 REF(MA21,1) MA13 REF(MA13,1) MA13 MA21) C REF(C,1),COLORYELLOW,0);
//DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,KKK) (MA21 REF(MA21,1) MA13 REF(MA13,1) MA5 MA13||MA21 REF(MA21,1) MA13 REF(MA13,1)),COLORWHITE,1);
//DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,KKK) (MA21 REF(MA21,1) MA13 REF(MA13,1) MA5 MA13||MA21 REF(MA21,1) MA13 REF(MA13,1)) C REF(C,1),COLORWHITE,0);
//DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,KKK) (MA21 REF(MA21,1) MA13 REF(MA13,1) MA13 MA21),COLORYELLOW,1);
//DRAWCOLORKLINE(VALUEWHEN(DDD||KKK,KKK) (MA21 REF(MA21,1) MA13 REF(MA13,1) MA13 MA21) C REF(C,1),COLORYELLOW,0);
//多空水平线
DRAWSL(VALUEWHEN(DDD||KKK,DDD),VALUEWHEN(DDD,C),0,1,0,COLORRED),LINETHICK2;
DRAWSL(VALUEWHEN(DDD||KKK,KKK),VALUEWHEN(KKK,C),0,1,0,COLORGREEN),LINETHICK2;
//多空分界线的数值,标志到点上
N:=5;
DRAWNUMBER1(DDD,H+N*MINPRICE,C,0),VALIGN2;//,FONTSIZE12
DRAWNUMBER1(KKK,L-N*MINPRICE,C,0),VALIGN0;//
//多空分界线的数值,标志到线上
//DRAWNUMBER1(DDD,L-N*MINPRICE,C,0),VALIGN0,FONTSIZE17;
//DRAWNUMBER1(KKK,H+N*MINPRICE,C,0),VALIGN2,FONTSIZE17;
//多空AB的转换点,思路一,比较A和B的高低
//DD:=CROSS(MA5 MA13 MA13 MA21 MA5 REF(MA5,1) MA13 REF(MA13,1) MA21 REF(MA21,1),0.5);//C MA5
//KK:=CROSS(MA5 MA13 MA13 MA21 MA5 REF(MA5,1) MA13 REF(MA13,1) MA21 REF(MA21,1),0.5);//
//DDD:=DD COUNT(DD,BARSLAST(KK))=1,WORD(0, A ),VALIGN0,FONTSIZE23;
//KKK:=KK COUNT(KK,BARSLAST(DD))=1,WORD(1, B ),VALIGN2,FONTSIZE23;
DDD C VALUEWHEN(KKK,C),WORD(0, A ),VALIGN0,FONTSIZE23,COLORRED;//
DDD C VALUEWHEN(KKK,C),WORD(0, A ),VALIGN0,FONTSIZE23;
KKK C VALUEWHEN(DDD,C),WORD(1, B ),VALIGN2,FONTSIZE23,COLORGREEN;//
KKK C VALUEWHEN(DDD,C),WORD(1, B ),VALIGN2,FONTSIZE23;
//所有符合条件的多空
//DRAWTEXT(DD NOT(DDD),H, 多
//DRAWTEXT(KK NOT(KKK),H, 空
//多空高低点的比较
J:=CROSS(VALUEWHEN(DDD||KKK,DDD),0.5),NODRAW;
S:=CROSS(VALUEWHEN(DDD||KKK,KKK),0.5),NODRAW;
H1:=VALUEWHEN(S,REF(HHV(H,BARSLAST(J)+1),1));
H2:=VALUEWHEN(S,REF(H1,1));
L1:=VALUEWHEN(J,REF(LLV(L,BARSLAST(S)+1),1));
L2:=VALUEWHEN(J,REF(L1,1));
//DRAWSHIFTNUMBER(S H1 H2,H1,H1,1,COLORRED,0,HHVBARS(H,BARSLAST(J)+1));
//DRAWSHIFTNUMBER(S H1 H2,H1,H1,1,COLORGREEN,0,HHVBARS(H,BARSLAST(J)+1));
//DRAWSHIFTNUMBER(J L1 L2,L1,L1,1,COLORGREEN,0,LLVBARS(L,BARSLAST(S)+1)),VALIGN0;
//DRAWSHIFTNUMBER(J L1 L2,L1,L1,1,COLORRED,0,LLVBARS(L,BARSLAST(S)+1)),VALIGN0;
//正在运行K线与前高低点的比较,不能分享
//DRAWSHIFTNUMBER(ISLASTBAR VALUEWHEN(DDD||KKK,DDD) HHV(H,BARSLAST(DDD)+1) H1,HHV(H,BARSLAST(DDD)+1),HHV(H,BARSLAST(DDD)+1),1,COLORRED,0,HHVBARS(H,BARSLAST(J)+1));
//DRAWSHIFTNUMBER(ISLASTBAR VALUEWHEN(DDD||KKK,DDD) HHV(H,BARSLAST(DDD)+1) H1,HHV(H,BARSLAST(DDD)+1),HHV(H,BARSLAST(DDD)+1),1,COLORGREEN,0,HHVBARS(H,BARSLAST(J)+1));
//DRAWSHIFTNUMBER(ISLASTBAR VALUEWHEN(DDD||KKK,KKK) LLV(L,BARSLAST(KKK)+1) L1,LLV(L,BARSLAST(KKK)+1),LLV(L,BARSLAST(KKK)+1),1,COLORRED,0,LLVBARS(L,BARSLAST(S)+1)),VALIGN0;
//DRAWSHIFTNUMBER(ISLASTBAR VALUEWHEN(DDD||KKK,KKK) LLV(L,BARSLAST(KKK)+1) L1,LLV(L,BARSLAST(KKK)+1),LLV(L,BARSLAST(KKK)+1),1,COLORGREEN,0,LLVBARS(L,BARSLAST(S)+1)),VALIGN0;