以下是文华的代码,转换成金字塔的
DK:=MA(C,10);
ZN:=MA(C,20);
//均线交叉波段
JC1:=CROSS(DK,ZN);
SC1:=CROSSDOWN(DK,ZN);
N11:=BARSLAST(JC1)+1;
N21:=BARSLAST(SC1)+1;
HH1:=BACKSET(REFX(SC1,1)||ISLASTBAR,HHVBARS(H,N11)+1);
LL1:=BACKSET(REFX(JC1,1)||ISLASTBAR,LLVBARS(L,N21)+1);
DRAWLINE1(CROSS(LL1,0.001),L,CROSS(HH1,0.001),H,0),COLORGRAY,DOT;
DRAWLINE1(CROSS(HH1,0.001),H,CROSS(LL1,0.001),L,0),COLORGRAY,DOT;
LL:=CROSS(LL1,0.001);
HH:=CROSS(HH1,0.001);
XXX:=LL && L<REF(L,SUMBARS(LL,2)-1) && REF(L,SUMBARS(LL,2)-1)<REF(L,SUMBARS(LL,3)-1) && REF(H,SUMBARS(HH,1)-1)<REF(H,SUMBARS(HH,2)-1);
DRAWLINE3(CROSS(LL,0.001)&&XXX,L,0,1,REF(H,SUMBARS(CROSS(HH,0.001),1)-1),SUMBARS(CROSS(HH,0.001),1)-1,0),COLORGREEN,LINETHICK2;
XXH:=HH && H>REF(H,SUMBARS(HH,2)-1) && REF(H,SUMBARS(HH,2)-1)>REF(H,SUMBARS(HH,3)-1)&& REF(L,SUMBARS(LL,1)-1)>REF(L,SUMBARS(LL,2)-1);
DRAWLINE3(CROSS(HH,0.001)&&XXH,H,0,1,REF(L,SUMBARS(CROSS(LL,0.001),1)-1),SUMBARS(CROSS(LL,0.001),1)-1,0),COLORRED,LINETHICK2;
默认波段线用虚线绘制,满足XXX或XXH条件时的波段加粗并上色
DK:=MA(C,10);
ZN:=MA(C,20);
//均线交叉波段
JC1:=CROSS(DK,ZN);
SC1:=CROSS(ZN,DK);
N11:=BARSLAST(JC1)+1;
N21:=BARSLAST(SC1)+1;
HH1:=BACKSET(REFX(SC1,1)||ISLASTBAR,HHVBARS(H,N11)+1);
LL1:=BACKSET(REFX(JC1,1)||ISLASTBAR,LLVBARS(L,N21)+1);
DRAWLINE(CROSS(LL1,0.001),L,CROSS(HH1,0.001),H,0,COLORGRAY,0,vtDASH);
DRAWLINE(CROSS(HH1,0.001),H,CROSS(LL1,0.001),L,0,COLORGRAY,0,vtDASH);
LL:=CROSS(LL1,0.001);
HH:=CROSS(HH1,0.001);
//
//XXX:=LL && L<REF(L,SUMBARS(LL,2)-1) && REF(L,SUMBARS(LL,2)-1)<REF(L,SUMBARS(LL,3)-1) && REF(H,SUMBARS(HH,1)-1)<REF(H,SUMBARS(HH,2)-1);
//DRAWLINE3(CROSS(LL,0.001)&&XXX,L,0,1,REF(H,SUMBARS(CROSS(HH,0.001),1)-1),SUMBARS(CROSS(HH,0.001),1)-1,0),COLORGREEN,LINETHICK2;
//
//
//XXH:=HH && H>REF(H,SUMBARS(HH,2)-1) && REF(H,SUMBARS(HH,2)-1)>REF(H,SUMBARS(HH,3)-1)&& REF(L,SUMBARS(LL,1)-1)>REF(L,SUMBARS(LL,2)-1);
//DRAWLINE3(CROSS(HH,0.001)&&XXH,H,0,1,REF(L,SUMBARS(CROSS(LL,0.001),1)-1),SUMBARS(CROSS(LL,0.001),1)-1,0),COLORRED,LINETHICK2;
//
注释掉的这部分实现不了。DRAWLINE3 实现的效果无法等效替换。