文华财经代码:
MID:MA(CLOSE,26);
TMP2:=STD(CLOSE,26);
TOP:MID+2*TMP2;
BOTTOM:MID-2*TMP2;
N:=BARSLAST(CROSSDOWN(L,BOTTOM))+1;
M:=BARSLAST(CROSS(H,TOP))+1;
LL:=IF(L<BOTTOM,L,100000);
HH:=IF(H>TOP,H,0);
LX:=BACKSET(M=1&&REF(EXIST(N=1,M),1),REF(LLVBARS(LL,M),1)+2);
HX:=BACKSET(N=1&&REF(EXIST(M=1,N),1),REF(HHVBARS(HH,N),1)+2);
DRAWLINE1(CROSS(LX=1,0.5),L,CROSS(HX=1,0.5),H,0),LINETHICK3,COLORRED;
DRAWLINE1(CROSS(HX=1,0.5),H,CROSS(LX=1,0.5),L,0),LINETHICK3,COLORGREEN;
//最高价上传上轨,取上穿之后的高点;
//最低价下穿下轨,取下穿之后的低点,进行连线
略加修改成金字塔代码如下:
MID:MA(CLOSE,26);
TMP2:=STD(CLOSE,26);
TOP:MID+2*TMP2;
BOTTOM:MID-2*TMP2;
N:=BARSLAST(CROSS(BOTTOM,L))+1;
M:=BARSLAST(CROSS(H,TOP))+1;
LL:=IF(L<BOTTOM,L,100000);
HH:=IF(H>TOP,H,0);
LX:=BACKSET(M=1&&REF(EXIST(N=1,M),1),REF(LLVBARS(LL,M),1)+2);
HX:=BACKSET(N=1&&REF(EXIST(M=1,N),1),REF(HHVBARS(HH,N),1)+2);
DRAWLINE(CROSS(LX=1,0.5),L,CROSS(HX=1,0.5),H,0),LINETHICK3,COLORRED;
DRAWLINE(CROSS(HX=1,0.5),H,CROSS(LX=1,0.5),L,0),LINETHICK3,COLORGREEN;
|