自动画线主图压力与支撑(缺口、明短线赢利、振幅)
//自动画线主图压力与支撑
INPUT:n(8,0,10),p(0,0,255),p1(0,0,255),p2(0,0,255);
TJA:=CLOSE>OPEN or CLOSE=OPEN and CLOSE>REF(CLOSE,1);
STICKLINE(TJA,LOW,HIGH,0,0),ColorE9;
STICKLINE(TJA,O,CLOSE,8,0),Color80;
STICKLINE(TJA,O,CLOSE,6,0),ColorA5;
STICKLINE(TJA,O,CLOSE,4,0),ColorC0;
STICKLINE(TJA,O,CLOSE,2,0),ColorE6;
STICKLINE(NOT(TJA),HIGH,LOW,0,0),Colorff00;
STICKLINE(NOT(TJA),CLOSE,OPEN,8,0),Color5000;
STICKLINE(NOT(TJA),CLOSE,OPEN,6,0),Color6600;
STICKLINE(NOT(TJA),CLOSE,OPEN,4,0),Color8000;
STICKLINE(NOT(TJA),CLOSE,OPEN,2,0),ColorA000;
BQ:=IF((SYSPARAM(1) = (BARSSINCE((C > 0)) + 1)),1,0);
BQ1:=(H<REF(L,1));
BQ2:=(L>REF(H,1));
STICKLINE(BQ1,o+(c-o)*0.25,O,5,0),colorcc0000;
STICKLINE(BQ1,o+(c-o)*0.25,O,3,0),colordd0000;
STICKLINE(BQ1,o+(c-o)*0.25,O,1,0),coloree0000;
STICKLINE(BQ2,O,o+(c-o)*0.25,6,0),color208AAA;
STICKLINE(BQ2,O,o+(c-o)*0.25,4,0),color208DDD;
STICKLINE(BQ2 ,O,o+(c-o)*0.25,2,0),color208FFF;
DRAWTEXT(((BQ > 0) AND Bq1),H,'↓缺口'),colorFFFFEE,pxdn10,ALIGN2;
DRAWTEXT(((BQ > 0) AND Bq2),L,'↑缺口'),color00FFEE,pxup20,ALIGN1;
QC:=REF(C,1);QO:=REF(O,1);QH:=REF(H,1);QL:=REF(L,1);
FUZ:=L+((H-L)/2);FUS:=O+((C-O)/2); FUSY:=C+((O-C)/2);SSFU:=(FUZ+IF(C>O,FUS,FUSY))/2;
FUZ1:=L+((H-L)*0.333);FUS1:=O+((C-O)*0.333);FUS1Y:=C+((O-C)*0.333);SSFU1:=(FUZ1+IF(C>O,FUS1,FUS1Y))/2;
FUZ2:=L+((H-L)*0.667);FUS2:=O+((C-O)*0.677);FUS2Y:=C+((O-C)*0.667);SSFU2:=(FUZ2+IF(C>O,FUS2,FUS2Y))/2;
BS1:=Ql+((Qh-Ql)/2);BS2:=QO+((QC-QO)/2);BS3:=QC+((QO-QC)/2);
DB1:=QL+((QH-QL)*0.333);DB2:=QO+((QC-QO)*0.333);DB3:=QC+((QO-QC)*0.333);
EB1:=QL+((QH-QL)*0.667);EB2:=QO+((QC-QO)*0.667);EB3:=QC+((QO-QC)*0.667);
SYB1:=QH-((QH-QC)/2);SYB2:=QH-((QH-QO)/2);
SYB3:=IF(QC>QO,SYB1,SYB2);
XYB1:=QL+((QC-QL)/2);XYB2:=QL+((QO-QL)/2);
XYB3:=IF(QC<QO,XYB1,XYB2);
QFU:=(BS1+IF(QC>QO,BS2,BS3))/2;
QDFU:=(DB1+IF(QC>QO,DB2,DB3))/2;
QEFU:=(EB1+IF(QC>QO,EB2,EB3))/2;
STICKLINE(C=C,SSFU2,SSFU2,4,0),COLOR00FF00,LINETHICK1;
STICKLINE(C=C,SSFU1,SSFU1,4,0),COLOR00FF00,LINETHICK1;
STICKLINE(C=C,SSFU,SSFU,6,0),COLOR00FFFF,LINETHICK1;
STICKLINE(C=C,IF(C>O,H-((H-C)/2),H-((H-O)/2)),IF(C>O,H-((H-C)/2),H-((H-O)/2)),1.3,0),COLORYELLOW,LINETHICK1;
STICKLINE(C=C,IF(C<O,L+((C-L)/2),L+((O-L)/2)),IF(C<O,L+((C-L)/2),L+((O-L)/2)),1.3,0),COLORYELLOW,LINETHICK1;
A3:=C=HHV(C,6);
A9:=C=LLV(C,6);
A4:=BARSLAST(A3);
A5:=BARSLAST(A9);
A6:=IF(A4,REF(C,A4),REF(C,A4))*1.005;
A7:=IF(A5,REF(C,A5),REF(C,A5))*0.995;
PARTLINE(A6=ref(A6,1),A6),COLOR00ff00,LINEDOT;
PARTLINE(A7=ref(A7,1),A7),COLOR00ffff,LINEDOT;
A1:=REF(H,N)=HHV(H,2*N+1); B1:=FILTER(A1,N);
C1:=BACKSET(B1,N+1); D1:=FILTER(C1,N);
A2:=REF(L,N)=LLV(L,2*N+1); B2:=FILTER(A2,N);
C2:=BACKSET(B2,N+1); D2:=FILTER(C2,N);
E1:=(REF(LLV(L,2*N),1)+REF(HHV(H,2*N),1))/2;
E2:=(H+L)/2;
H1:=(D1 AND NOT(D2 AND E1>=E2)) OR BARSTATUS=2 OR BARSCOUNT(C)=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,L,10000),X1));
G1:=F1>REF(F1,1); I1:=BACKSET(G1,2); LD:=I1>REF(I1,1);
L2:=LD OR BARSTATUS=2 OR BARSCOUNT(C)=1;X2:=REF(BARSLAST(L2),1)+1;
F2:=BACKSET(L2 AND COUNT(H2,X2)>0,HHVBARS(IF(H2,H,0),X2));
G2:=F2>REF(F2,1); I2:=BACKSET(G2,2); HD:=I2>REF(I2,1);
R1:=BACKSET(BARSTATUS=2,BARSLAST(HD)+1); S1:=R1>REF(R1,1);
T1:=BACKSET(BARSTATUS=2,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);
T3:=BACKSET(U2,REF(BARSLAST(LD),1)+2); U3:=T3>REF(T3,1);
T4:=BACKSET(U3,REF(BARSLAST(LD),1)+2); U4:=T4>REF(T4,1);
R3:=BACKSET(S2,REF(BARSLAST(HD),1)+2); S3:=R3>REF(R3,1);
R4:=BACKSET(S3,REF(BARSLAST(HD),1)+2); S4:=R4>REF(R4,1);
DRAWLINE(S2,H,S1,H,1),Color009999;
DRAWLINE(U2,L,U1,L,1),POINTDOT,Color009999;
DRAWLINE(S3,H,S2,H,1),Color999900;
DRAWLINE(U3,L,U2,L,1),POINTDOT,Color999900;
DRAWLINE(S4,H,S3,H,1),ColorEEAAEE;
DRAWLINE(U4,L,U3,L,1),POINTDOT,ColorEEAAEE;
DRAWSL(SYSPARAM(1)=BARPOS,REF(L,SYSPARAM(1)=SUM(1,0)-1),0,0,1),COLORGREEN;
DRAWSL(SYSPARAM(1)=BARPOS,REF(H,SYSPARAM(1)=SUM(1,0)-1),0,0,1),COLORRED;
TTt:=ISLASTBAR=1;
AS1:=((H-L)/L)*100;
AS2:=H-L;
MAI:=C*1.015;
MAII:=C*1.03;
DRAWTEXTEX(TTT,0,310,1,'▼明短线赢利[1.5%--3%:]'+'/'+NUMTOSTR(MAI[SYSPARAM(1)],2)+'--'+NUMTOSTR(MAII [SYSPARAM(1)],2)),Color00dd00;
DRAWTEXTEX(TTt,0,176,1,'【振幅:'+NUMTOSTR(AS1[SYSPARAM(1)],2)+'% '+NUMTOSTR(AS2[SYSPARAM(1)],2)+'元 】'+''),Colordddd00;
DRAWTEXTEX(TTT,0,1,1,'【代码:'+STKLABEL+' 名称:'+STKNAME+'】'),ColorffFFFF;
as:=(o+h+l+c)/4;
BL: eMA(as,p),linethick1,Color208FFF;
BL1: MA(C,p1),linethick1,ColorFFFFFF;
BL2: MA(C,p2),linethick1,Color00FFFF;
BLT:=BARSTATUS=2;
DRAWTEXT(BLT AND BL>REF(BL,1),BL,'ENA↑'+NUMTOSTR(p,0)+':'+NUMTOSTR(BL,2)),COLOR208fff;
DRAWTEXT(BLT AND BL<REF(BL,1),BL,'↓'+NUMTOSTR(p,0)+':'+NUMTOSTR(BL,2)),Color208FFF;
DRAWTEXT(BLT AND BL1>REF(BL1,1),BL1,'↑'+NUMTOSTR(p1,0)+':'+NUMTOSTR(BL1,2)),COLORFFffff;
DRAWTEXT(BLT AND BL1<REF(BL1,1),BL1,'↓'+NUMTOSTR(p1,0)+':'+NUMTOSTR(BL1,2)),ColorFFFDED;
DRAWTEXT(BLT AND BL2>REF(BL2,1),BL2,'↑'+NUMTOSTR(p2,0)+':'+NUMTOSTR(BL2,2)),COLOR00CCCC;
DRAWTEXT(BLT AND BL2<REF(BL2,1),BL2,'↓'+NUMTOSTR(p2,0)+':'+NUMTOSTR(BL2,2)),Color00CCCC;
|