文华财经多空波段变色趋势买卖主图指标源码:支撑压力自动画线、多空波段K线变色、多空文字提示、开盘时间画竖线、20日均线
DIFF :=EMA(CLOSE,12) – EMA(CLOSE,26);
DEA :=EMA(DIFF,9);
MACD:=2*(DIFF-DEA),COLORSTICK;
MA20:MA(C,21),COLORWHITE,LINETHICK1;
COND1:=CROSS(C>MA20&&DIFF>DEA,0.5);
COND2:=CROSS(C<MA20&&DIFF<DEA,0.5);
DRAWCOLORKLINE(ISUP=0,COLORGREEN,0);
DRAWCOLORKLINE(ISUP,COLORGREEN,1);
DRAWCOLORKLINE(COND2&&COUNT(COND2,BARSLAST(COND1))=1,COLORWHITE,0);
DRAWLINE3(DAYBARPOS=1,H,0,1,H+1,0,1),COLORWHITE,DOT;
DRAWLINE3(DAYBARPOS=1,L,0,1,L-1,0,1),COLORWHITE,DOT;
STICKLINE1(COND1&&COUNT(COND1,BARSLAST(COND2))=1,O,C,4,0),COLORRED;
STICKLINE1(COND2&&COUNT(COND2,BARSLAST(COND1))=1,O,C,4,0),COLORWHITE;
STICKLINE1(COND1&&COUNT(COND1,BARSLAST(COND2))=1,H,L,0,0),COLORRED;
STICKLINE1(COND2&&COUNT(COND2,BARSLAST(COND1))=1,H,L,0,0),COLORWHITE;
N:=13;
HH:HHV(C,N);
LL:LLV(C,N);
DD:=HH>REF(HH,1);
KK:=LL<REF(LL,1);
DD&&COUNT(DD,BARSLAST(KK)+1)=1,WORD(0,’多’),FONTSIZE16;
KK&&COUNT(KK,BARSLAST(DD)+1)=1,WORD(1,’空’),VALIGN0,FONTSIZE16;
//突破支撑和压力位后K线的颜色红绿
DRAWCOLORKLINE(BARSLAST(DD)<BARSLAST(KK),COLORRED,1);
DRAWCOLORKLINE(BARSLAST(DD)>BARSLAST(KK),COLORGREEN,1);
DRAWCOLORKLINE(BARSLAST(DD)<BARSLAST(KK)&&ISDOWN,COLORRED,0);
DRAWCOLORKLINE(BARSLAST(DD)>BARSLAST(KK)&&ISDOWN,COLORGREEN,0);
T1:=BARSLAST(DD&&COUNT(DD,BARSLAST(KK)+1)=1)+1;
T2:=BARSLAST(KK&&COUNT(KK,BARSLAST(DD)+1)=1)+1;
H1:=VALUEWHEN(KK&&COUNT(KK,BARSLAST(DD)+1)=1,REF(HHV(H,T1),1));
H2:=VALUEWHEN(KK&&COUNT(KK,BARSLAST(DD)+1)=1,REF(H1,1));
L1:=VALUEWHEN(DD&&COUNT(DD,BARSLAST(KK)+1)=1,REF(LLV(L,T2),1));
L2:=VALUEWHEN(DD&&COUNT(DD,BARSLAST(KK)+1)=1,REF(L1,1));
DRAWSHIFTNUMBER(KK&&COUNT(KK,BARSLAST(DD)+1)=1&&H1>H2,H1,H1,0,COLORRED,0,REF(HHVBARS(H,T1),1)+1);
DRAWSHIFTNUMBER(KK&&COUNT(KK,BARSLAST(DD)+1)=1&&H1<H2,H1,H1,0,COLORGREEN,0,REF(HHVBARS(H,T1),1)+1);
DRAWSHIFTNUMBER(KK&&COUNT(KK,BARSLAST(DD)+1)=1&&H1=H2,H1,H1,0,COLORYELLOW,0,REF(HHVBARS(H,T1),1)+1);
DRAWSHIFTNUMBER(DD&&COUNT(DD,BARSLAST(KK)+1)=1&&L1>L2,L1,L1,0,COLORRED,0,REF(LLVBARS(L,T2),1)+1),VALIGN0;
DRAWSHIFTNUMBER(DD&&COUNT(DD,BARSLAST(KK)+1)=1&&L1<L2,L1,L1,0,COLORGREEN,0,REF(LLVBARS(L,T2),1)+1),VALIGN0;
DRAWSHIFTNUMBER(DD&&COUNT(DD,BARSLAST(KK)+1)=1&&L1=L2,L1,L1,0,COLORYELLOW,0,REF(LLVBARS(L,T2),1)+1),VALIGN0;
DRAWSHIFTNUMBER(ISLASTBAR&&BARSLAST(DD)<BARSLAST(KK)&&HHV(H,T1)>H1,HHV(H,T1),HHV(H,T1),0,COLORRED,0,HHVBARS(H,T1));
DRAWSHIFTNUMBER(ISLASTBAR&&BARSLAST(DD)<BARSLAST(KK)&&HHV(H,T1)<H1,HHV(H,T1),HHV(H,T1),0,COLORGREEN,0,HHVBARS(H,T1));
DRAWSHIFTNUMBER(ISLASTBAR&&BARSLAST(DD)<BARSLAST(KK)&&HHV(H,T1)=H1,HHV(H,T1),HHV(H,T1),0,COLORYELLOW,0,HHVBARS(H,T1));
DRAWSHIFTNUMBER(ISLASTBAR&&BARSLAST(DD)>BARSLAST(KK)&&LLV(L,T2)>L1,LLV(L,T2),LLV(L,T2),0,COLORRED,0,LLVBARS(L,T2)),VALIGN0;
DRAWSHIFTNUMBER(ISLASTBAR&&BARSLAST(DD)>BARSLAST(KK)&&LLV(L,T2)<L1,LLV(L,T2),LLV(L,T2),0,COLORGREEN,0,LLVBARS(L,T2)),VALIGN0;
DRAWSHIFTNUMBER(ISLASTBAR&&BARSLAST(DD)>BARSLAST(KK)&&LLV(L,T2)=L1,LLV(L,T2),LLV(L,T2),0,COLORYELLOW,0,LLVBARS(L,T2)),
VALIGN0;