I thought, that sometimes when browsing historical charts, it might be useful to be able to tell what day of the week it was. Below code not only separates consequtive days, but helps spotting some patterns that are likely to occure on Mondays, Fridays etc. In this example the ribbon in the lower part of the screen is the darkest on Mondays and the brightest on Fridays. Additionally there are numbers - from 1 (Monday) to 5 (Friday), which allow to precisely identify each day of the week. Ribbon's and numbers' colors, can be changed via chart parameters.


_SECTION_BEGIN( "Days of week" );
// by Miłosz Mazurkiewicz
/// @link https://forum.amibroker.com/t/background-color-change-for-each-separate-day-in-intraday-charts-how-to-visually-identify-days-of-the-week-on-the-chart/6881/10
dn = DateNum(); dw = DayOfWeek();
FirstBarOfDay = dn != Ref( dn, -1 );
Color1 = ParamColor( "Ribbon's color", colorLightYellow );
Color2 = ParamColor( "Numbers' color", colorBlack );
RibbonHeight = 5; // Percent of chart height
for( i = 1; i <= 5; i++ ) VarSet( "C" + i, ColorBlend( colorBlack, Color1, i / 5 ) );
RibbonColor = IIf( DW == 1, C1, IIf( dw == 2, C2, IIf( dw == 3, C3, IIf( dw == 4, C4, IIf( dw == 5, C5, colorDefault ) ) ) ) );
//Plot( Close, "Close", colorDefault, styleCandle );
Plot( FirstBarOfDay, "", Color1, styleHistogram | styleOwnScale | styleNoLabel, 1, 0, 0, -1, 2 );
Plot( RibbonHeight, "", RibbonColor, styleArea | styleOwnScale | styleNoLabel, 0, 100, 0, -1 );
PlotShapes( FirstBarOfDay * ( 33 + dw * 2 ), Color2, 0, LowestVisibleValue( L ), 6, 5 );
if (Interval() >= inDaily) Error("Change interval to Intraday");
_SECTION_END();
The main part of the code uses only Arrays and PlotShapes. To be able to display names of days instead of numbers, I would need to use loop to iterate through all visible bars. Later I I'm going to add such modified code.