ONCE TF = gettimeframe
IF TF = 604800 THEN //Weekly
IF OpenMonth <> OpenMonth[1] THEN
IF cc > oo THEN
DrawRectangle(Barra,Massimo,BarIndex-1,Minimo) coloured("Blue",30) bordercolor("white",0)
ELSE
DrawRectangle(Barra,Massimo,BarIndex-1,Minimo) coloured("Red",30) bordercolor("white",0)
ENDIF
Barra = BarIndex
Massimo = high
Minimo = low
OO = open
ENDIF
ELSIF TF = 86400 THEN //Daily
IF OpenDayOfWeek < OpenDayOfWeek[1] THEN
IF cc > oo THEN
DrawRectangle(Barra,Massimo,BarIndex-1,Minimo) coloured("Blue",30) bordercolor("white",0)
ELSE
DrawRectangle(Barra,Massimo,BarIndex-1,Minimo) coloured("Red",30) bordercolor("white",0)
ENDIF
Barra = BarIndex
Massimo = high
Minimo = low
OO = open
ENDIF
ENDIF
Massimo = max(Massimo,high)
Minimo = min(Minimo,low)
cc = close
DrawRectangle(Barra,Massimo,BarIndex,Minimo) coloured("Grey",10) bordercolor("grey",0)
RETURN