划线判趋势
{法利辨势-六主图}
参数:
input:n(3,2,9999),m(0,0,9999),n1(21,0,9999),p1(0,0,999),p2(10,0,999),p3(20,0,999),p4(30,0,999),p5(60,0,999),p6(120,0,999),p7(240,0,999),p8(360,0,999),n2(1,1,8);
A1:=REF(HIGH,N)=HHV(HIGH,2*N+1);
B1:=FILTER(A1,N);
C1:=BACKSET(B1,N+1);
D1:=FILTER(C1,N);
A2:=REF(LOW,N)=LLV(LOW,2*N+1);
B2:=FILTER(A2,N);
C2:=BACKSET(B2,N+1);
D2:=FILTER(C2,N);
E1:=(REF(LLV(LOW,2*N),1)+REF(HHV(HIGH,2*N),1))/2;
E2:=(HIGH+LOW)/2;
H1:=D1 AND NOT(D2 AND E1>=E2) OR ISLASTBAR OR BARSCOUNT(CLOSE)=1;
L1:=D2 AND NOT(D1 AND E1<E2);
H2:=D1 AND NOT(D2 AND E1>=E2);
X1:=REF(BARSLAST(H1),1)+1;
F1:=BACKSET(H1 AND COUNT(L1,X1)>0,LLVBARS(IF(L1,LOW,10000),X1));
G1:=F1>REF(F1,1);
I1:=BACKSET(G1,2);
LD:I1>REF(I1,1),LINETHICK0;
L2:=LD OR ISLASTBAR OR BARSCOUNT(CLOSE)=1;
X2:=REF(BARSLAST(L2),1)+1;
F2:=BACKSET(L2 AND COUNT(H2,X2)>0,HHVBARS(IF(H2,HIGH,0),X2));
G2:=F2>REF(F2,1);
I2:=BACKSET(G2,2);
HD:I2>REF(I2,1),LINETHICK0;
DRAWLINE(HD,HIGH,LD,LOW,0),LINETHICK1,colorFFFF;
DRAWLINE(LD,LOW,HD,HIGH,0),LINETHICK1,colorFFFF;
J1:=BACKSET(ISLASTBAR,MIN(BARSLAST(HD),BARSLAST(LD))+1);
J2:=J1>REF(J1,1);
DRAWLINE(J2,IF(HD,HIGH,LOW),ISLASTBAR,IF(BARSLAST(HD)>BARSLAST(LD),HIGH,LOW),0),colorFFFF;
DRAWLINE(LD,LOW,HD,HIGH,0),colorFF9900;
DRAWLINE(HD,HIGH,LD,LOW,0),colorFF9900;
J1:=BACKSET(ISLASTBAR,MIN(BARSLAST(HD),BARSLAST(LD))+1);
J2:=J1>REF(J1,1);
DRAWLINE(J2,IF(HD,HIGH,LOW),ISLASTBAR,IF(BARSLAST(HD)>BARSLAST(LD),HIGH,LOW),0),colorFF9900;
R1:=BACKSET(ISLASTBAR,BARSLAST(HD)+1);
S1:=R1>REF(R1,1);
T1:=BACKSET(ISLASTBAR,BARSLAST(LD)+1);
U1:=T1>REF(T1,1);
R2:=BACKSET(S1,REF(BARSLAST(HD),1)+2);
S2:=R2>REF(R2,1);
T2:=BACKSET(U1,REF(BARSLAST(LD),1)+2);
U2:=T2>REF(T2,1);
短高:REF(HIGH,BARSLAST(S1)),LINETHICK1;
短低:REF(LOW,BARSLAST(U1)),LINETHICK1;
短比:(CLOSE-短低)/(短高-短低),LINETHICK0;
DRAWLINE(S2,HIGH,S1,HIGH,1);
DRAWLINE(U2,LOW,U1,LOW,1);
V1:=LINEVALUE(S2,HIGH,S1,HIGH,0,1);
V2:=LINEVALUE(U2,LOW,U1,LOW,0,1);
A3:=HIGH<REF(HIGH,REF(BARSLAST(HD),1)+1);
B3:=REF(HIGH,REF(BARSLAST(HD),1)+1)>REF(HIGH,REF(BARSLAST(HD),1)+2+REF(BARSLAST(HD),REF(BARSLAST(HD),1)+2));
D3:=A3 AND B3 AND HD;
E3:=BACKSET(D3,REF(BARSLAST(HD),1)+2);
HZ:=E3>REF(E3,1);
A4:=LOW>REF(LOW,REF(BARSLAST(LD),1)+1);
B4:=REF(LOW,REF(BARSLAST(LD),1)+1)<REF(LOW,REF(BARSLAST(LD),1)+2+REF(BARSLAST(LD),REF(BARSLAST(LD),1)+2));
D4:=A4 AND B4 AND LD;
E4:=BACKSET(D4,REF(BARSLAST(LD),1)+2);
LZ:=E4>REF(E4,1);
R3:=BACKSET(ISLASTBAR,BARSLAST(HZ)+1);
S3:=R3>REF(R3,1);
T3:=BACKSET(ISLASTBAR,BARSLAST(LZ)+1);
U3:=T3>REF(T3,1);
长高:REF(HIGH,BARSLAST(S3)),LINETHICK2;
长低:REF(LOW,BARSLAST(U3)),LINETHICK2;
长比:(CLOSE-长低)/(长高-长低),LINETHICK0;
PARTLINE(1,长低+(长高-长低)/2),colorFF;
PARTLINE(1,长低+(长高-长低)/3),POINTDOT,colorDDDDDD;
PARTLINE(1,长低+2*(长高-长低)/3),POINTDOT,colorDDDDDD;
A:=BARSCOUNT(CLOSE)=SYSPARAM(2);
B:=BARSLAST(A);
CC:=REF(INDEXC,B)/REF(CLOSE,B);
DD1:=INDEXO/CC;
DD2:=INDEXH/CC;
DD3:=INDEXL/CC;
DD4:=INDEXC/CC;
STICKLINE(M AND DD4>=REF(DD4,1),DD3,DD1,0.1,0),colorFF66FF;
STICKLINE(M AND DD4>=REF(DD4,1),DD4,DD2,0.1,0),colorFF66FF;
STICKLINE(M AND DD4>=REF(DD4,1),DD1,DD4,7,1),colorFF66FF;
STICKLINE(M AND DD4<REF(DD4,1),DD3,DD2,0.1,0),color99FF33;
STICKLINE(M AND DD4<REF(DD4,1),DD4,DD1,7,0),color99FF33;
背离系数:100*(CLOSE-DD4)/DD4,LINETHICK0;
WX:=MA(CLOSE,0);
AA1:=REF(HIGH,3)=HHV(HIGH,2*3+1);
AAA:=FILTER(AA1,3);
BB1:=BACKSET(AAA,3+1);
CC1:=FILTER(BB1,3);
CC:=CC1 OR ISLASTBAR;
AA2:=REF(LOW,3)=LLV(LOW,2*3+1);
AAA2:=FILTER(AA2,3);
BB2:=BACKSET(AAA2,3+1);
CC22:=FILTER(BB2,3);
GG1:=ISLASTBAR AND REF(CC1,BARSLAST(CC1));
HH:=BACKSET(GG1,BARSLAST(CC1)+1);
II:=HH>REF(HH,1);
JJ1:=REF(BARSLAST(CC1),1);
KK:=BACKSET(II,JJ1+2);
LL:=KK>REF(KK,1);
DRAWLINE(LL,HIGH,II,HIGH,1),LINESTICK,LINETHICK4,colorFF00FF;
CS:=(REF(HIGH,BARSLAST(II))-REF(HIGH,BARSLAST(LL)))/(BARSLAST(LL)-BARSLAST(II));
阻力线:=REF(HIGH,BARSLAST(II))+BARSLAST(II)*CS;
压力:阻力线,LINETHICK0,colorFF00FF;
DRAWICON(II,HIGH,12);
DRAWICON(LL,HIGH,12);
GG2:=ISLASTBAR AND REF(CC22,BARSLAST(CC22));
HH2:=BACKSET(GG2,BARSLAST(CC22)+1);
II2:=HH2>REF(HH2,1);
JJ2:=REF(BARSLAST(CC22),1);
KK2:=BACKSET(II2,JJ2+2);
LL2:=KK2>REF(KK2,1);
DRAWLINE(LL2,LOW,II2,LOW,1),LINESTICK,LINETHICK4,colorFF00;
CS1:=(REF(LOW,BARSLAST(II2))-REF(LOW,BARSLAST(LL2)))/(BARSLAST(LL2)-BARSLAST(II2));
阻力线1:=REF(LOW,BARSLAST(II2))+BARSLAST(II2)*CS1;
支撑:阻力线,LINETHICK0,colorFF00;
上:=HHV(HIGH,N);
下:=LLV(LOW,N);
A1:=HHVBARS(HIGH,N);
B1:=BACKSET(ISLASTBAR,A1+1);
D1:=FILTER(B1,N);
A2:=LLVBARS(LOW,N);
B2:=BACKSET(ISLASTBAR,A2+1);
D2:=FILTER(B2,N);
GD1:=REF(HIGH,BARSLAST(D1))+REF(LOW,BARSLAST(D2));
GD2:=REF(HIGH,BARSLAST(D1))-REF(LOW,BARSLAST(D2));
顶:=REF(HIGH,BARSLAST(D1));
底:=REF(LOW,BARSLAST(D2));
中:底+GD2/2,LINETHICK1,colorFF;
三一:REF(LOW,BARSLAST(D2))+GD2/3,colorDDDDDD;
三二:REF(LOW,BARSLAST(D2))+GD2*2/3,colorDDDDDD;
黄:REF(HIGH,BARSLAST(D1))-GD2*0.382,POINTDOT,colorFFFF;
金:REF(HIGH,BARSLAST(D1))-GD2*0.618,POINTDOT,colorFFFF;
四二:REF(HIGH,BARSLAST(D1))-GD2*0.25,POINTDOT,colorFFFF00;
四三:REF(HIGH,BARSLAST(D1))-GD2*0.75,POINTDOT,colorFFFF00;
上:=HHV(HIGH,N1);
下:=LLV(LOW,N1);
A1:=HHVBARS(HIGH,N1);
B1:=BACKSET(ISLASTBAR,A1+1);
D1:=FILTER(B1,N1);
A2:=LLVBARS(LOW,N1);
B2:=BACKSET(ISLASTBAR,A2+1);
D2:=FILTER(B2,N1);
GD1:=REF(HIGH,BARSLAST(D1))+REF(LOW,BARSLAST(D2));
GD2:=REF(HIGH,BARSLAST(D1))-REF(LOW,BARSLAST(D2));
顶:REF(HIGH,BARSLAST(D1));
底:REF(LOW,BARSLAST(D2));
AAAA:底+GD2/2,LINETHICK5,colorFF;
WX:=MA(CLOSE,0);
M1:MA(CLOSE,P1);
M2:MA(CLOSE,P2)*(IF(N2<2,WX,1));
M3:MA(CLOSE,P3)*(IF(N2<3,WX,1));
M4:MA(CLOSE,P4)*(IF(N2<4,WX,1));
M5:MA(CLOSE,P5)*(IF(N2<5,WX,1));
M6:MA(CLOSE,P6)*(IF(N2<6,WX,1));
M7:MA(CLOSE,P7)*(IF(N2<7,WX,1));
M8:MA(CLOSE,P8)*(IF(N2<8,WX,1)); |