A:=WEEKDAY<>REF(WEEKDAY,1);
B:=BARSLAST(A);
MM:=BACKSET(ISLASTBAR,BARSLAST((REFX(A,1))&&C>REF(O,B))+1),NODRAW;
DRAWLINE3((REFX(A,1))&&C>REF(O,B)&&MM,HHV(MAX(C,O),B+1),0,1,LLV(MIN(C,O),B+1),0,0),COLORRED,LINETHICK4;
DRAWLINE3((REFX(A,1))&&C>REF(O,B)&&MM,HHV(MAX(C,O),B+1),BARSLAST(A),1,LLV(MIN(C,O),B+1),BARSLAST(A),0),COLORRED,LINETHICK4;
DRAWLINE3((REFX(A,1))&&C>REF(O,B)&&MM,HHV(MAX(C,O),B+1),0,1,HHV(MAX(C,O),B+1),BARSLAST(A),0),COLORRED,LINETHICK4;
DRAWLINE3((REFX(A,1))&&C>REF(O,B)&&MM,LLV(MIN(C,O),B+1),0,1,LLV(MIN(C,O),B+1),BARSLAST(A),0),COLORRED,LINETHICK4;
DRAWLINE3((REFX(A,1))&&C<=REF(O,B)&&MM,HHV(MAX(C,O),B+1),0,1,LLV(MIN(C,O),B+1),0,0),COLORGREEN,LINETHICK4;
DRAWLINE3((REFX(A,1))&&C<=REF(O,B)&&MM,HHV(MAX(C,O),B+1),BARSLAST(A),1,LLV(MIN(C,O),B+1),BARSLAST(A),0),COLORGREEN,LINETHICK4;
DRAWLINE3((REFX(A,1))&&C<=REF(O,B)&&MM,HHV(MAX(C,O),B+1),0,1,HHV(MAX(C,O),B+1),BARSLAST(A),0),COLORGREEN,LINETHICK4;
DRAWLINE3((REFX(A,1))&&C<=REF(O,B)&&MM,LLV(MIN(C,O),B+1),0,1,LLV(MIN(C,O),B+1),BARSLAST(A),0),COLORGREEN,LINETHICK4;
DRAWLINE3(ISLASTBAR&&C>REF(O,BARSLAST(WEEKDAY<REF(WEEKDAY,1))),HHV(MAX(C,O),BARSLAST(WEEKDAY<REF(WEEKDAY,1))+1),0,1,LLV(MIN(C,O),BARSLAST(WEEKDAY<REF(WEEKDAY,1))+1),0,0),COLORRED,LINETHICK4;
DRAWLINE3(ISLASTBAR&&C>REF(O,BARSLAST(WEEKDAY<REF(WEEKDAY,1))),HHV(MAX(C,O),BARSLAST(WEEKDAY<REF(WEEKDAY,1))+1),BARSLAST(WEEKDAY<REF(WEEKDAY,1)),1,LLV(MIN(C,O),BARSLAST(WEEKDAY<REF(WEEKDAY,1))+1),BARSLAST(WEEKDAY<REF(WEEKDAY,1)),0),COLORRED,LINETHICK4;
DRAWLINE3(ISLASTBAR&&C>REF(O,BARSLAST(WEEKDAY<REF(WEEKDAY,1))),HHV(MAX(C,O),BARSLAST(WEEKDAY<REF(WEEKDAY,1))+1),0,1,HHV(MAX(C,O),BARSLAST(WEEKDAY<REF(WEEKDAY,1))+1),BARSLAST(WEEKDAY<REF(WEEKDAY,1)),0),COLORRED,LINETHICK4;
DRAWLINE3(ISLASTBAR&&C>REF(O,BARSLAST(WEEKDAY<REF(WEEKDAY,1))),LLV(MIN(C,O),BARSLAST(WEEKDAY<REF(WEEKDAY,1))+1),0,1,LLV(MIN(C,O),BARSLAST(WEEKDAY<REF(WEEKDAY,1))+1),BARSLAST(WEEKDAY<REF(WEEKDAY,1)),0),COLORRED,LINETHICK4;
DRAWLINE3(ISLASTBAR&&C<=REF(O,BARSLAST(WEEKDAY<REF(WEEKDAY,1))),HHV(MAX(C,O),BARSLAST(WEEKDAY<REF(WEEKDAY,1))+1),0,1,LLV(MIN(C,O),BARSLAST(WEEKDAY<REF(WEEKDAY,1))+1),0,0),COLORGREEN,LINETHICK4;
DRAWLINE3(ISLASTBAR&&C<=REF(O,BARSLAST(WEEKDAY<REF(WEEKDAY,1))),HHV(MAX(C,O),BARSLAST(WEEKDAY<REF(WEEKDAY,1))+1),BARSLAST(WEEKDAY<REF(WEEKDAY,1)),1,LLV(MIN(C,O),BARSLAST(WEEKDAY<REF(WEEKDAY,1))+1),BARSLAST(WEEKDAY<REF(WEEKDAY,1)),0),COLORGREEN,LINETHICK4;
DRAWLINE3(ISLASTBAR&&C<=REF(O,BARSLAST(WEEKDAY<REF(WEEKDAY,1))),HHV(MAX(C,O),BARSLAST(WEEKDAY<REF(WEEKDAY,1))+1),0,1,HHV(MAX(C,O),BARSLAST(WEEKDAY<REF(WEEKDAY,1))+1),BARSLAST(WEEKDAY<REF(WEEKDAY,1)),0),COLORGREEN,LINETHICK4;
DRAWLINE3(ISLASTBAR&&C<=REF(O,BARSLAST(WEEKDAY<REF(WEEKDAY,1))),LLV(MIN(C,O),BARSLAST(WEEKDAY<REF(WEEKDAY,1))+1),0,1,LLV(MIN(C,O),BARSLAST(WEEKDAY<REF(WEEKDAY,1))+1),BARSLAST(WEEKDAY<REF(WEEKDAY,1)),0),COLORGREEN,LINETHICK4;