三组连续自动画趋势线
2017-08-10网络 编 辑:翔博软件
{参数 N 1 200 3 }
WN:=N;
WA1:=REF(H,WN)=HHV(H,2*WN+1);
WB1:=FILTER(WA1,WN);
WC1:=BACKSET(WB1,WN+1);
WD1:=FILTER(WC1,WN);
WA2:=REF(L,WN)=LLV(L,2*WN+1);
WB2:=FILTER(WA2,WN);
WC2:=BACKSET(WB2,WN+1);
WD2:=FILTER(WC2,WN);
WE1:=(REF(LLV(L,2*WN),1)+REF(HHV(H,2*WN),1))/2;
WE2:=(H+L)/2;
WH1:=(WD1 AND NOT(WD2 AND WE1>=WE2)) OR ISLASTBAR OR BARSCOUNT(C)=1;
WL1:=(WD2 AND NOT(WD1 AND WE1<WE2));
WH2:=WD1 AND NOT(WD2 AND WE1>=WE2);
WX1:=REF(BARSLAST(WH1),1)+1;
WF1:=BACKSET(WH1 AND COUNT(WL1,WX1)>0,LLVBARS(IF(WL1,L,10000),WX1));
WG1:=WF1>REF(WF1,1);
WI1:=BACKSET(WG1,2);
WLD:=WI1>REF(WI1,1);
WL2:=WLD OR ISLASTBAR OR BARSCOUNT(C)=1;
WX2:=REF(BARSLAST(WL2),1)+1; WF2:=BACKSET(WL2 AND COUNT(WH2,WX2)>0,HHVBARS(IF(WH2,H,0),WX2));
WG2:=WF2>REF(WF2,1);
WI2:=BACKSET(WG2,2);
WHD:=WI2>REF(WI2,1);
WR1:=BACKSET(ISLASTBAR,BARSLAST(WHD)+1); WS1:=WR1>REF(WR1,1);
WT1:=BACKSET(ISLASTBAR,BARSLAST(WLD)+1); WU1:=WT1>REF(WT1,1);
WR2:=BACKSET(WS1,REF(BARSLAST(WHD),1)+2); WS2:=WR2>REF(WR2,1);
WT2:=BACKSET(WU1,REF(BARSLAST(WLD),1)+2); WU2:=WT2>REF(WT2,1);
WT3:=BACKSET(WU2,REF(BARSLAST(WLD),1)+2); WU3:=WT3>REF(WT3,1);
WT4:=BACKSET(WU3,REF(BARSLAST(WLD),1)+2); WU4:=WT4>REF(WT4,1);
WR3:=BACKSET(WS2,REF(BARSLAST(WHD),1)+2); WS3:=WR3>REF(WR3,1);
WR4:=BACKSET(WS3,REF(BARSLAST(WHD),1)+2); WS4:=WR4>REF(WR4,1);
DRAWLINE(WS2,H,WS1,H,1),COLORYELLOW;
DRAWLINE(WU2,L,WU1,L,1),DOTLINE,COLORYELLOW;
DRAWLINE(WS3,H, WS2,H,1),COLORBLUE;
DRAWLINE(WU3,L,WU2,L,1),DOTLINE,COLORBLUE;
DRAWLINE(WS4,H,WS3,H,1),COLORRED;
DRAWLINE(WU4,L,WU3,L,1),DOTLINE,COLORRED;