趋势划线
{趋势划线主图 DZH2}
input: k(2,0,2),n(10,1,255),p1(3,1,255);
BBI:(MA(CLOSE,3)+MA(CLOSE,6)+MA(CLOSE,12)+MA(CLOSE,24))/4,pointdot,COLORFFFFFF;
BBI2:BBI+3*STD(BBI,10),pointdot,COLORmagenta;
BBI3:BBI-3*STD(BBI,10),pointdot,COLORblue;
B1:=MA(CLOSE,1);
B2:=SMA(SMA(SMA(B1,2,1),2,1),2,1) ;
SMA2:=MA(B2,3) ;
FILLRGN(b2,sma2,b2>sma2),colorred;
FILLRGN(b2,sma2,b2<sma2),colorgreen;
var9Q:=c= hhv(c,4)and (ref(c,1)>=ref(c,2) or ref(c,1)>=ref(c,3))
or ref(c,1)=hhv(c,4) and close>=ref(c,2)
or ref(c,2)=hhv(c,4) and ref(c,3)=llv(c,4) and c>=ref(c,1)
or ref(c,3)=hhv(c,4) and c>=ref(c,1) and c>=ref(c,2);
红持:var9Q,color0000ff,LINETHICK0;
varaQ:=c=hhv(c,4) and ref(c,1)=llv(c,4);
粉变:varaQ,colorff99ff,LINETHICK0;
varbQ:=c=llv(c,4) and (ref(c,1)<ref(c,2) or ref(c,1)<ref(c,3))
or ref(c,1)=llv(c,4) and c<ref(c,2)
or ref(c,2)=llv(c,4) and ref(c,1)<>hhv(c,4) and c<ref(c,1)
or ref(c,3)=llv(c,4) and c<ref(c,1) and c<ref(c,2);
灰跌:varbQ,color888888,LINETHICK0;
varcQ:=ref(c,1)=llv(c,4) and c>=ref(c,2) or ref(c,2)=llv(c,4)
and ref(c,1)<=ref(c,3) and ref(c,2)<ref(c,4) and c>=ref(c,1);
绿买:varcQ,color00ff00,LINETHICK0;
vardQ:=ref(c,1)=hhv(c,4) and c<ref(c,2)
or (ref(c,2)=hhv(c,4) and ref(c,1)>ref(c,3)
or ref(c,3)=hhv(c,4) and ref(c,1)>ref(c,2))
and ref(c,2)>=ref(c,4) and c<ref(c,1);
蓝抛:vardQ,colorff9900,LINETHICK0;
if DATATYPE>1 then begin;
xxx1:=(C+L+H)/3;
xxx2:EMA(xxx1,6),colorFFFFFF,linethick1;
xxx3:EMA(xxx2,5),color00FFFF,linethick1;
VAR1111:=BACKSET(REF(HIGH,2)=HHV(HIGH,5),3);
VAR2222:=CROSS(VAR1111,0.9);
VAR3333:=BACKSET(REF(LOW,2)=LLV(LOW,5),3);
VAR4444:=CROSS(VAR3333,0.9);
压力: REF(HIGH,BARSLAST(Var2222)), POINTDOT,ColorEA91B5;
STICKLINE(CLOSE,REF(HIGH,BARSLAST(Var2222)),REF(HIGH,BARSLAST(Var2222)),5,0),ColorEA91B5;
支撑: REF(LOW,BARSLAST(Var4444)), POINTDOT,Color00b4ff;
STICKLINE(CLOSE,REF(LOW,BARSLAST(Var4444)),REF(LOW,BARSLAST(Var4444)),5,0),Color00b4ff;
下档线:=(((CLOSE - LLV(LOW,13)) / (HHV(HIGH,13) - LLV(LOW,13))) * 100);
aRSV:=SMA(下档线,3,1);
aK:=SMA(aRSV,3,1);
aD:=((3 * aRSV) - (2 * aK));
aJ12:=(((CLOSE - LLV(LOW,55)) / (HHV(HIGH,55) - LLV(LOW,55))) * 100);
aRSV24:=SMA(aJ12,3,1);
aK24:=SMA(aRSV24,3,1);
aD24:=((3 * aRSV24) - (2 * aK24));
撑压位:=IF(CROSS(aD24,aD),HIGH,REF(HIGH,BARSLAST(CROSS(aD24,aD)))){,LINETHICK2,COLORFFFFFF};
底:=LLV(HIGH,30){,COLOR00FF00,LINETHICK2};
STICKLINE(BARSTATUS=2 ,撑压位,撑压位,30,1),LINETHICK1,COLORFFFFFF;
DRAWTEXT(BARSTATUS=2 ,撑压位,' 撑压'),COLORFFFFFF,VALIGN1;
STICKLINE(BARSTATUS=2 ,底,底,30,1),COLOR00FF00,LINETHICK1;
DRAWTEXT(BARSTATUS=2 ,底,' 底线'),COLOR00FF00,VALIGN0;
END;
STICKLINE(CLOSE>OPEN,OPEN,LOW,0.5,0 ),COLOR0000FF;
STICKLINE(CLOSE>OPEN,CLOSE,HIGH,0.5 ,0 ),COLOR0000FF;
STICKLINE(OPEN>=CLOSE,CLOSE,LOW,0.5 ,0 ),COLOR00FF00;
STICKLINE(OPEN>=CLOSE,OPEN,HIGH,0.5 ,0 ),COLOR00FF00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,7,0 ),COLORff7700;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,6,0 ),COLORff9900;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,5,0 ),COLORffbb00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,4,0 ),COLORffcc00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,3,0 ),COLORffdd00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,2,0 ),COLORffee00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,1,0 ),COLORffFF00;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,7,0) ,COLOR000055;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,6,0) ,COLOR000066;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,5,0) ,COLOR000077;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,4,0) ,COLOR000099;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,3,0) ,COLOR0000bb;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,2,0) ,COLOR0000dd;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,1,0) ,COLOR0000ff;
stickline(var9Q,c,(o+c)/2,7,0),color000077;
stickline(var9Q,c,(o+c)/2,6,0),color000088;
stickline(var9Q,c,(o+c)/2,5,0),color0000aa;
stickline(var9Q,c,(o+c)/2,4,0),color0000cc;
stickline(var9Q,c,(o+c)/2,2,0),color0000ff;
stickline(var9Q,c,(o+c)/2,0,0),COLORffffff;
stickline(varaQ,c,(o+c)/2,7,0),colorff11ff;
stickline(varaQ,c,(o+c)/2,6,0),colorff33ff;
stickline(varaQ,c,(o+c)/2,5,0),colorff55ff;
stickline(varaQ,c,(o+c)/2,4,0),colorff77ff;
stickline(varaQ,c,(o+c)/2,3,0),colorff99ff;
stickline(varaQ,c,(o+c)/2,2,0),colorffbbff;
stickline(varaQ,c,(o+c)/2,1,0),colorffddff;
stickline(varbQ,c,(o+c)/2,7,0),color333333;
stickline(varbQ,c,(o+c)/2,6,0),color555555;
stickline(varbQ,c,(o+c)/2,5,0),color777777;
stickline(varbQ,c,(o+c)/2,4,0),color999999;
stickline(varbQ,c,(o+c)/2,3,0),colorbbbbbb;
stickline(varbQ,c,(o+c)/2,2,0),colordddddd;
stickline(varbQ,c,(o+c)/2,1,0),colorffffff;
stickline(varcQ,o,(o+c)/2,7,0),color003300;
stickline(varcQ,o,(o+c)/2,6,0),color005500;
stickline(varcQ,o,(o+c)/2,5,0),color007700;
stickline(varcQ,o,(o+c)/2,4,0),color009900;
stickline(varcQ,o,(o+c)/2,3,0),color00bb00;
stickline(varcQ,o,(o+c)/2,2,0),color00dd00;
stickline(varcQ,o,(o+c)/2,1,0),color00ff00;
stickline(vardQ,o,(o+c)/2,7,0),colorff1100;
stickline(vardQ,o,(o+c)/2,6,0),colorff3300;
stickline(vardQ,o,(o+c)/2,5,0),colorff5500;
stickline(vardQ,o,(o+c)/2,4,0),colorff7700;
stickline(vardQ,o,(o+c)/2,3,0),colorff9900;
stickline(vardQ,o,(o+c)/2,2,0),colorffbb00;
stickline(vardQ,o,(o+c)/2,1,0),colorffdd00;
V7:=BARSTATUS=2;
V8:=(REF(HIGH,n) = HHV(HIGH,((2 * n) + 1)));
V9:=FILTER(V8,n);
VA:=BACKSET(V9,(n + 1));
VB:=FILTER(VA,n);
VC:=(VB OR V7);
VD:=(REF(LOW,n) = LLV(LOW,((2 * n) + 1)));
VE:=FILTER(VD,n);
VF:=BACKSET(VE,(n + 1));
V10:=FILTER(VF,n);
V11:=(V10 AND NOT(VB));
V12:=BACKSET(VC,(REF(BARSLAST(V11),1) + 1));
V13:=(V12 > REF(V12,1));
V14:=BACKSET(V13,2);
V15:=(V14 > REF(V14,1));
V16:=BACKSET((V15 AND (COUNT(VC,(REF(BARSLAST(V11),1) + 2)) = 0)),(REF(BARSLAST(V11),1) + 2));
V17:=(V16 > REF(V16,1));
V18:=BACKSET((V17 AND (COUNT(VC,(REF(BARSLAST(V11),1) + 2)) = 0)),(REF(BARSLAST(V11),1) + 2));
V19:=(V18 > REF(V18,1));
V1A:=IF(VC,COUNT(V11,(REF(BARSLAST(VC),1) + 1)),0);
V1B:=IF(((V1A = 1) AND VC),BARSLAST(V15),0);
V1C:=IF((VC AND (REF(LOW,BARSLAST(V15)) >= REF(LOW,BARSLAST(V17)))),BARSLAST(V17),BARSLAST(V15));
V1D:=IF(((V1A = 2) AND VC),V1C,0);
V1E:=IF(((V1A >= 3) AND VC),IF((VC AND (REF(LOW,V1C) >= REF(LOW,BARSLAST(V19)))),BARSLAST(V19),V1C),0);
V1F:=( |