A1111:=TIME>=0900&&TIME<=1200; B1111:=TIME>=1200&&TIME<=1600; CC1111:=(TIME>=2100||TIME<=0800); N1TT:=BARSLAST(CROSS(A1111,0.5))+1; N2TT:=BARSLAST(CROSS(B1111,0.5))+1; N3TT:=IF(EXIST(TIME=2100,BARPOS),BARSLAST(CROSS(CC1111,0.5))+1,BARPOS); TTTTT:=BACKSET(ISLASTBAR,MIN1(N1TT,N2TT,N3TT)); NNFHJK:=IF(REF(MA(C,5),BARSLAST(H=HHV(H,7)))>REF(MA(C,10),BARSLAST(H=HHV(H,7))) AND BARSLAST(H=HHV(H,7))<=4,BARSLAST(H=HHV(H,7)),IF(REF(MA(C,5),BARSLAST(L=LLV(L,7)))<REF(MA(C,10) ,BARSLAST(L=LLV(L,7))) AND BARSLAST(L=LLV(L,7))<=4,BARSLAST(L=LLV(L,7)),5)) ,NODRAW; HHFHJK:=REF(H,IF(ISLASTBAR AND NNFHJK>0,NNFHJK,5))=HHV(H,6); LLFHJK:=REF(L,IF(ISLASTBAR AND NNFHJK>0,NNFHJK,5))=LLV(L,6); FG01FHJK:=BACKSET(HHFHJK,IF(ISLASTBAR AND NNFHJK>0,NNFHJK,5)+1)>BACKSET(HHFHJK,IF(ISLASTBAR AND NNFHJK>0,NNFHJK,5)); FD01FHJK:=BACKSET(LLFHJK,IF(ISLASTBAR AND NNFHJK>0,NNFHJK,5)+1)>BACKSET(LLFHJK,IF(ISLASTBAR AND NNFHJK>0,NNFHJK,5)); FG02FHJK:=FG01FHJK=FD01FHJK AND MA(C,5)>MA(C,10); FD02FHJK:=FG01FHJK=FD01FHJK AND MA(C,5)<MA(C,10); FG0FHJK:=FG01FHJK AND IF(FG02FHJK=1,H=HHV(H,BARSLAST(REF(FD01FHJK,1))+1),H=HHV(H,IF(BARSLAST(L=LLV(L,7))>=5,5,BARSLAST(FD01FHJK)))) AND FD02FHJK=0; FD0FHJK:=FD01FHJK AND IF(FD02FHJK=1,L=LLV(L,BARSLAST(REF(FG01FHJK,1))+1),L=LLV(L,IF(BARSLAST(H=HHV(L,7))>=5,5,BARSLAST(FG01FHJK)))) AND FG02FHJK=0; FG1FHJK:=BACKSET(REFX(BARSLAST(FG0FHJK),1)=0 AND BARSLAST(FG0FHJK)<BARSLAST(FD0FHJK) AND REFX(H,1)>=REF(H,BARSLAST(FG0FHJK)),BARSLAST(FG0FHJK)+1); FD1FHJK:=BACKSET(REFX(BARSLAST(FD0FHJK),1)=0 AND BARSLAST(FD0FHJK)<BARSLAST(FG0FHJK) AND REFX(L,1)<=REF(L,BARSLAST(FD0FHJK)),BARSLAST(FD0FHJK)+1); FG11FHJK:=IF(BARSLAST(FG0FHJK)=0 AND REF(BARSLAST(FG0FHJK),1)<BARSLAST(FD0FHJK) AND IF(REF(MA(C,5),BARSLAST(L=LLV(L,7)))>REF(MA(C,10),BARSLAST(L=LLV(L,7))) ,BARSLAST(L=LLV(L,7))<5,1) AND H<REF(H,REF(BARSLAST(FG0FHJK),1)+1),1,0); FD11FHJK:=IF(BARSLAST(FD0FHJK)=0 AND REF(BARSLAST(FD0FHJK),1)<BARSLAST(FG0FHJK) AND IF(REF(MA(C,5),BARSLAST(H=HHV(H,7)))<REF(MA(C,10),BARSLAST(H=HHV(H,7))) ,BARSLAST(H=HHV(H,7))<5,1) AND L>REF(L,REF(BARSLAST(FD0FHJK),1)+1),1,0); GT1FHJK:=BARSLAST(FG11FHJK<>1 AND FG1FHJK<>1 AND FG0FHJK); DT1FHJK:=BARSLAST(FD11FHJK<>1 AND FD1FHJK<>1 AND FD0FHJK); FD2FHJK:=BACKSET(REFX(GT1FHJK,1)=0 AND DT1FHJK<3 AND GT1FHJK-DT1FHJK<4 AND REF(L,DT1FHJK)>LLV(L,GT1FHJK+5),DT1FHJK+1); FG2AFHJK:=BACKSET(REFX(GT1FHJK,1)=0 AND DT1FHJK<3 AND GT1FHJK-DT1FHJK<4 AND REF(L,DT1FHJK)<=LLV(L,GT1FHJK+5) AND REF(H,GT1FHJK)>HHV(H,GT1FHJK+5),GT1FHJK+1); FG2BFHJK:=IF(GT1FHJK=0 AND DT1FHJK<4 AND REF(GT1FHJK,1)-DT1FHJK<4 AND REF(L,DT1FHJK)<=LLV(L,REF(GT1FHJK,1)+6) AND H>HHV(H,REF(GT1FHJK,1)+6),1,0); FG2FHJK:=BACKSET(REFX(DT1FHJK,1)=0 AND GT1FHJK<3 AND DT1FHJK-GT1FHJK<4 AND REF(H,GT1FHJK)<HHV(H,DT1FHJK+5),GT1FHJK+1); FD2AFHJK:=BACKSET(REFX(DT1FHJK,1)=0 AND GT1FHJK<3 AND DT1FHJK-GT1FHJK<4 AND REF(H,GT1FHJK)>=HHV(L,DT1FHJK+5) AND REF(L,DT1FHJK)>LLV(L,DT1FHJK+5),DT1FHJK+1); FD2BFHJK:=IF(DT1FHJK=0 AND GT1FHJK<4 AND REF(DT1FHJK,1)-GT1FHJK<4 AND REF(H,GT1FHJK)>=HHV(H,REF(DT1FHJK,1)+6) AND L>LLV(L,REF(DT1FHJK,1)+6),1,0); FG21FHJK:=IF(GT1FHJK=0 AND DT1FHJK<4 AND H<HHV(H,REF(GT1FHJK,1)+3),1,0); FD21FHJK:=IF(DT1FHJK=0 AND GT1FHJK<4 AND L>LLV(L,REF(DT1FHJK,1)+3) ,1,0); FD231FHJK:=BACKSET(REFX(GT1FHJK,1)=0 AND DT1FHJK>3 AND GT1FHJK>DT1FHJK AND GT1FHJK-DT1FHJK<4 AND REFX(H,1)>REF(H,GT1FHJK) AND REF(L,DT1FHJK)>REF(LLV(L,10),DT1FHJK),DT1FHJK+1); FG23FHJK:=BACKSET(REFX(GT1FHJK,1)=0 AND DT1FHJK>3 AND GT1FHJK>DT1FHJK AND GT1FHJK-DT1FHJK<4 AND REFX(H,1)>REF(H,GT1FHJK) AND (REF(H,GT1FHJK)<REF(HHV(H,13),GT1FHJK) OR REF(FD231FHJK,DT1FHJK)=0),GT1FHJK+1); FG231FHJK:=BACKSET(REFX(DT1FHJK,1)=0 AND GT1FHJK>3 AND DT1FHJK>GT1FHJK AND DT1FHJK-GT1FHJK<4 AND REFX(L,1)<REF(L,DT1FHJK) AND REF(H,GT1FHJK)<REF(HHV(H,10),GT1FHJK) ,GT1FHJK+1); FD23FHJK:=BACKSET(REFX(DT1FHJK,1)=0 AND GT1FHJK>3 AND DT1FHJK>GT1FHJK AND DT1FHJK-GT1FHJK<4 AND REFX(L,1)<REF(L,DT1FHJK) AND ( REF(L,DT1FHJK)>REF(LLV(L,13),DT1FHJK) OR REF(FG231FHJK,GT1FHJK)=0),DT1FHJK+1); FD24FHJK:=BACKSET(REFX(GT1FHJK,1)=0 AND DT1FHJK>3 AND GT1FHJK>DT1FHJK AND GT1FHJK-DT1FHJK<4 AND REFX(H,1)<HHV(H,GT1FHJK+3) AND REF(L,DT1FHJK)>LLV(L,DT1FHJK+5),DT1FHJK+1); FG24FHJK:=BACKSET(REFX(DT1FHJK,1)=0 AND GT1FHJK>3 AND DT1FHJK>GT1FHJK AND DT1FHJK-GT1FHJK<4 AND REFX(L,1)>LLV(L,DT1FHJK+3) AND REF(H,GT1FHJK)<HHV(H,GT1FHJK+5),GT1FHJK+1); GT2FHJK:=BARSLAST(FG21FHJK<>1 AND FG23FHJK<>1 AND FG231FHJK<>1 AND FG24FHJK<>1 AND FG2FHJK<>1 AND FG2AFHJK<>1 AND FG2BFHJK<>1 AND GT1FHJK=0); DT2FHJK:=BARSLAST(FD21FHJK<>1 AND FD23FHJK<>1 AND FD231FHJK<>1 AND FD24FHJK<>1 AND FD2FHJK<>1 AND FD2AFHJK<>1 AND FD2BFHJK<>1 AND DT1FHJK=0); FG3FHJK:=BACKSET(REFX(GT2FHJK,1)=0 AND GT2FHJK<DT2FHJK AND REFX(H,1)>=REF(H,GT2FHJK),GT2FHJK+1),NODRAW; FD3FHJK:=BACKSET(REFX(DT2FHJK,1)=0 AND DT2FHJK<GT2FHJK AND REFX(L,1)<=REF(L,DT2FHJK),DT2FHJK+1); FG31FHJK:=IF(GT2FHJK=0 AND REF(GT2FHJK,1)<DT2FHJK AND H<REF(H,REF(GT2FHJK,1)+1),1,0); FD31FHJK:=IF(DT2FHJK=0 AND REF(DT2FHJK,1)<GT2FHJK AND L>REF(L,REF(DT2FHJK,1)+1),1,0); HHH:=BARSLAST(GT2FHJK=0 AND FG3FHJK<>1 AND FG31FHJK<>1 )=0 AND FG31FHJK<>1 AND FG3FHJK<>1; LLL:=BARSLAST(DT2FHJK=0 AND FD3FHJK<>1 AND FD31FHJK<>1)=0 AND FD31FHJK<>1 AND FD3FHJK<>1; //T1:=BACKSET(ISLASTBAR,BARSLAST(VALUEWHEN(HHH,H)||VALUEWHEN(LLL,L))+1);//|| && DRAWSL(A1&&PERIOD<=1&&EXIST(LLL,BARSLAST(HHH))=0&&TTTTT,VALUEWHEN(HHH,H),0,1,0,COLORYELLOW),LINETHICK3; DRAWCOLORKLINE(A1&&PERIOD<=1&&CROSS(EXIST(HHH,BARSLAST(LLL))=0,0.5)&&C>=O&&TTTTT,COLORGREEN,0); DRAWLINE(A1&&PERIOD<=1&&CROSS(EXIST(HHH,BARSLAST(LLL))=0,0.5)&&TTTTT,H,1,L,0),COLORGREEN,LINETHICK3; |
|