@Ravin, in the great majority of cases, for intraday bars, @Sebastian's solution works well.
There is a small inconvenience when you have some shortened session (i.e., when on a particular day - typically before festivities - the trading closes early).
To show it, I artificially created a shortened session: normal sessions in this example are from 08:00 to 22:00; I removed all the quotes after 19:00 on Dec. 21st.

The lime line (representing "yesterday") in the second yellow box is actually part of the current session (same values of the "Close" - light blue line - at the opening of the "today" session as in the first box).
This happens rarely, but t is possible to overcome it (leaving empty areas in the line plot) with a couple of additions to his code.
I did it verbosely to make it more readable.
NDS = New_Day_Signal = Ref( Day(), 0 ) != Ref( Day(), -1 );
// YD = Yesterday = Ref(Close,ValueWhen(NDS,BarIndex(),2)-ValueWhen(NDS,BarIndex(),1));
// BY = Before_Yesterday = Ref(Close,ValueWhen(NDS,BarIndex(),3)-ValueWhen(NDS,BarIndex(),1));
back1d_bars = ValueWhen( NDS, BarIndex(), 2 ) - ValueWhen( NDS, BarIndex(), 1 );
back1d = Ref( Close, back1d_bars );
back2d_bars = ValueWhen( NDS, BarIndex(), 3 ) - ValueWhen( NDS, BarIndex(), 1 );
back2d = Ref( Close, back2d_bars );
tn = TimeNum();
YD = Yesterday = IIf( tn == Ref( tn, back1d_bars ), back1d, Null );
BY = Before_Yesterday = IIf( tn == Ref( tn, back2d_bars ), back2d, Null );
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Close %g " + "{{VALUES}}", C));
Plot(Close,"Close",colorLightBlue,styleLine);
Plot(YD,"Yesterday Sessions",colorLime,styleLine);
Plot(BY,"Before Yesterday Session",colorRed,styleLine);

As mentioned, since this is a very infrequent happening, it's probably not worth it!