\begin{tikzpicture}[scale=0.45]
	% custom colors
	\definecolor{lightblue}{RGB}{220, 220, 255}
	\definecolor{lightgreen}{RGB}{220, 255, 220}
	
	% messages
	\foreach \x in {1,1.5,...,21}{\draw[] (\x,0) rectangle (\x+0.5,2);}
	\foreach \x in {1.5,2,...,20.5}{\draw[fill=lightgray] (\x,0) rectangle (\x+0.5,2);}
%	\foreach \x in {1.5,2,...,10.5}{\draw[fill=lightblue] (\x,0) rectangle (\x+0.5,2);}
%	\foreach \x in {11.5,12,...,20.5}{\draw[fill=lightgreen] (\x,0) rectangle (\x+0.5,2);}
	
	% targeted message
	\draw[fill=red] (11,0) rectangle (11.5,2);
	\node[] at (11.25,5.75) {Targeted message};
	\draw (11.25,5.25) -- (11.25,2);
	
	% context period
	\draw[decorate,decoration={brace,mirror,amplitude=10pt},yshift=-30pt] (1.5,-0.5) -- (21,-0.5) node [midway,yshift=-0.6cm]{Context period};
	% before period
	\draw[decorate,decoration={brace,amplitude=10pt},yshift=-30pt] (1.5,4.5) -- (11,4.5) node [midway,yshift=0.6cm]{Past messages};
	% after period
	\draw[decorate,decoration={brace,amplitude=10pt},yshift=-30pt] (11.5,4.5) -- (21,4.5) node [midway,yshift=0.6cm]{Future messages};
	
	% vertical dots
%	\foreach \x in {1.5,21}{\draw[ultra thick,dashed] (\x,-0.25) -- (\x,2.5);}
	\foreach \x in {1.5,21}{\draw[dotted] (\x,-1.65) -- (\x,3.60);}
	\foreach \x in {11,11.5}{\draw[dotted] (\x,2.00) -- (\x,3.60);}
	% horizontal dots
%	\foreach \x in {-0.5,21.7}{\draw[ultra thick,loosely dotted] (\x,1) -- (\x+1.3,1);}
	\draw[ultra thick,loosely dotted] (-0.5,1) -- (0.8,1);
	\draw[ultra thick,loosely dotted,->] (21.7,1) -- (23.3,1);
	
	% current message
	\draw[fill=blue, thick] (7.5,0) rectangle (8,2);
	\node[] at (7.75,-1.10) {Current message};
	\draw (7.75,0) -- (7.75,-0.75);
	
	% sliding window
	\node[] at (5.25,2.75) {Sliding window};	
	\draw[ultra thick] (2.5,-0.25) rectangle (8,2.25);
 \end{tikzpicture}
 