B:ZIG(3,10),coloryellow;
G:=MA(B,2),colorred;
D:=EMA(B,34),colorgreen;
J:=EMA(B,144),colorligreen;
DRAWICON(CROSS(B,G),B-0.1,1);
DRAWICON(CROSS(G,B),G+0.1,2);
//DRAWTEXT(CROSS(B,G),B*0.85,"建"),coloryellow;
//DRAWTEXT(CROSS(G,B),G,"清"),colorgreen;
F:=100*(C-REF(C,1))/REF(C,1);
JD:=IF(C<REF(O,1) AND F<0,1,0);
S1:=JD;
MR:=IF(C<REF(O,2) AND F<0,1,0),LINETHICK0;
S2:=MR;
A1:=S1=0 AND REF(S1,1)=1 AND S2=0 AND REF(S2,1)=1 AND CROSS(ZIG(3,3) ,REF(ZIG(3 ,3),1));
A2:=S1=0 AND REF(S1,1)=1 AND S2=0 AND REF(S2,1)=1 AND CROSS(ZIG(3,5) ,REF(ZIG(3 ,5),1));
//DRAWTEXT(A1 AND A2 OR D<0,B,'加仓'),coloryellow;//加仓买
//DRAWICON(A1 AND A2,B-0.2,1);
VAR3:=PEAKBARS(3,5,1)<10;
VAR5:=IF(VAR3=1,2,0);
顶:= IF(VAR5=2,2,0);
顶A:=IF(顶>REF(顶,1),1,0),STICK,colorcyan, LINETHICK2;//
//DRAWTEXT(顶A=1,B*1.1,'减仓'),colorgreen;
DRAWICON(顶A=1,B,2);
A11:LLV(LOW,144),colormagenta;
//DRAWICON(A11==REF(A11,1) AND REF(A11,1)<REF(A11,2),A11,1);
//DRAWICON(A11<REF(A11,1) AND REF(A11,1)==REF(A11,2),A11,2);
//DRAWICON(A11>REF(A11,1) AND REF(A11,1)==REF(A11,2),A11,1);
MID:=MA(CLOSE,26);
UPPER:=MID + 2*STD(CLOSE,26),colorwhite;//上轨
UPPER1:=MID + 1.618*STD(CLOSE,26),colorred;//上轨
LOWER:=MID - 2*STD(CLOSE,26),coloryellow;//下轨
LOWER1:=MID - 1.618*STD(CLOSE,26),colorgreen;//下轨
//DRAWTEXT(CROSS(CLOSE,LOWER),J*1.05,"L"),coloryellow;;
//DRAWTEXT(CROSS(CLOSE,UPPER),J*1.05,"L"),colorgreen;
DRAWICON(CROSS(B,A11),B,1);
DRAWICON(CROSS(A11,B),B,2);
VERLINE(CROSS(B,G) AND (A1 AND A2 OR D<0),1),colorlimagenta;//画加仓建仓垂线
VERLINE(CROSS(G,B),1),colorcyan;//画清仓垂线
STICKLINE(A11<B AND B>REF(B,1),B,A11,0.8,0),colorred;
STICKLINE(A11<B AND B<REF(B,1),B,A11,0.8,0),colorgreen;
DRAWTEXT((CROSS(B,G) AND (A1 AND A2 OR D<0)) OR CROSS(B,G),A11*0.95,'B'),coloryellow;//建仓加仓买
STICKLINE(A11>B AND B>REF(B,1),B,A11,0.8,0),colorred;
STICKLINE(A11>B AND B<REF(B,1),B,A11,0.8,0),colorgreen;
A34:=LLV(B,34),coloryellow;
A55:=LLV(B,55),coloryellow;
A144:=LLV(B,144),coloryellow;
AA:=(CROSS(B,G) AND (A1 AND A2 OR D<0)) OR CROSS(B,G);
POLYLINE(AA==1,REF(B,1)),coloryellow;
CC:=CLOSE,colorwhite;
DD7:DYNAINFO(7),nodraw;
DD1:=DYNAINFO(1),nodraw;
DD2:=DYNAINFO(2),nodraw;
DD3:=DYNAINFO(3),nodraw;
DD4:=DYNAINFO(4),nodraw;
DD5:=DYNAINFO(5),nodraw;
DD6:=DYNAINFO(6),nodraw;
DD7:=DYNAINFO(7),nodraw;
DD9:=DYNAINFO(9),nodraw;
DD11:=DYNAINFO(11),nodraw;
DD20:=DYNAINFO(20),nodraw;
DD21:=DYNAINFO(21),nodraw;
DD28:=DYNAINFO(28),nodraw;
DD29:=DYNAINFO(29),nodraw;
DD30:=DYNAINFO(30),nodraw;
E:=TFILT(CLOSE,DATE+19000000,0,DATE+19000000,0),nodraw;
E1:=DLOW,nodraw;
E2:=IF(CODELIKE('600'),6,3),nodraw;
E3:=BARSLAST(CLOSE/REF(CLOSE,1)>=1.095),nodraw;//上一条件成立位置 上一次条件成立到当前的周期数
E4:=TFILT(CLOSE,DATE+19000000-E3,0,DATE+19000000-E3,0),nodraw;
E5:=BARSSINCE(CLOSE/REF(CLOSE,1)>=1.095,E3),nodraw;
E6:=CONST(CLOSE),nodraw;
E7:=REFDATE(CLOSE,DATE-1),nodraw;
THEYEAR := 1900*10000;
DATE1:= 20180703 - THEYEAR ;
DATE2:= 20180702 - THEYEAR ;
收盘0703:=REFDATE(CLOSE,DATE1),nodraw;
收盘0702:=REFDATE(CLOSE,DATE2),nodraw;
E8:=REF(C,BARSLAST(DATE=20180702)),nodraw;
指定日期:=YEAR==2016 AND MONTH==7 AND DAY==3,NODRAW;
当日收盘:=REF(CLOSE,BARSLAST(指定日期));
昨日收盘:=REF(CLOSE,BARSLAST(YEAR==2018 AND MONTH==7 AND DAY==2));
//MACD
DIFF:=EMA(CLOSE,12) - EMA(CLOSE,26);
DEA:=EMA(DIFF,9);
MACD:=2*(DIFF-DEA);
DRAWTEXT(CROSS(DIFF,DEA),A11,"M"),coloryellow;
DRAWTEXT(CROSS(DEA,DIFF),A11,"M"),colorgreen;
H1:HOD(H,144),nodraw;
L1:LOD(L,144),nodraw;
DRAWTEXT(H1=144 AND L1=1 AND B>A11,A11*0.95,"HL"),colorred;
LLV1:LLVBARS(L,21),nodraw;
DRAWNUMBER(REF((CROSS(B,G) AND (A1 AND A2 OR D<0)) OR CROSS(B,G),1),A11*0.95,TOSTRING(A11,2));