通达信公式 两峰三峰箱体主图
N1:=10;
N2:=60;
N3:=10;
A1:=REFX(HHV(H,N1),N1-1);{N1为峰的宽度}{N2为箱体宽度}
A2:=IF(H=HHV(H,N1) H=A1,H,DRAWNULL);
高点:=IF(A2=REF(A2,1),DRAWNULL,A2);
F1:=FINDHIGH(高点,0,N2,1);
F2:=FINDHIGH(高点,0,N2,2);
AVGH:=(H+C+O+L)/4;
平均:=(F1+F2+AVGH)/3;
方差:=POW(F1-平均,2)+POW(F2-平均,2)+POW(AVGH-平均,2);
标准差:=SQRT(方差);
B1:=标准差 =(N3/100);
C1:=COUNT(B1 0 AND REF(B1,1)=0,0);
C2:=CONST(C1)-C1;
P1:=BARSLAST(C2=0 AND REF(C2,1)
P2:=CONST(P1);
L1:=CONST(REF(AVGH,P1));
LL1:IF(H L1,DRAWNULL,L1),DOTLINE;
L2:IF(CURRBARSCOUNT =(N2+P2) AND CURRBARSCOUNT =P2,L1,DRAWNULL)COLORYELLOW,DOTLINE;
LOW1:=IF(ISLASTBAR,FINDLOW(L,P2,N2,1),DRAWNULL);
L3:IF(CURRBARSCOUNT =(N2+P2) AND CURRBARSCOUNT =P2,CONST(LOW1),DRAWNULL)COLORYELLOW,DOTLINE;
STICKLINE(CURRBARSCOUNT=P2 OR CURRBARSCOUNT=(P2+N2),L2,L3,0.000001,0)COLORYELLOW;
F3:=FINDHIGH(高点,0,N2,3);
B平均:=(F1+F2+F3+AVGH)/4;
BFC:=POW(F1-平均,2)+POW(F2-平均,2)+POW(F3-B平均,2)+POW(AVGH-平均,2);
BBZC:=SQRT(BFC);
BB1:=BBZC =(N3/70);
BC1:=COUNT(BB1 0 AND REF(BB1,1)=0,0);
BC2:=CONST(BC1)-BC1;
BP1:=BARSLAST(BC2=0 AND REF(BC2,1)
BP2:=CONST(BP1);
BL1:=CONST(REF(AVGH,BP1));
BBL1:IF(H BL1,DRAWNULL,BL1),DOTLINE;
BL2:IF(CURRBARSCOUNT =(N2+BP2) AND CURRBARSCOUNT =BP2,BL1,DRAWNULL)COLORYELLOW,DOTLINE;
BLOW1:=IF(ISLASTBAR,FINDLOW(L,BP2,N2,1),DRAWNULL);
BL3:IF(CURRBARSCOUNT =(N2+BP2) AND CURRBARSCOUNT =BP2,CONST(BLOW1),DRAWNULL)COLORYELLOW,DOTLINE;
STICKLINE(CURRBARSCOUNT=BP2 OR CURRBARSCOUNT=(BP2+N2),BL2,BL3,0.000001,0)COLORYELLOW;