You completely mix up things again.
I did not say to use intraday code with END time of interval setting.
Also don't use that posted intraday code. It is suppose to retrieve daily bar data of VIX of same day when SPY is selected symbol and if intraday interval is selected. But you do not want to use intraday time frame so do not use that time frame functions code.
Also do not set to End time of interval anymore. I was saying that it was tested on local DB. And there time component is removed with that setting if daily interval is selected. But since you use data plugin don't use it that way.
Anyway to bring this to an end.
Create composite of VIX via Analysis-Scan.
(I will not explain how to use analysis and scan as you just have to read manual and articles and forum.)
So I just tell the main part.
Save this code as AFL
if ( Status("action") == actionScan ) {
if ( Status( "stocknum" ) == 0 ) {
StaticVarRemove( "~VIX_daily" );
}
StaticVarAdd( "~VIX_daily", C );
Buy = 0;
}
// Used in other environments in addition to Scan
VIX = StaticVarGet("~VIX_daily");
_TRACE("!CLEAR!");
_TRACEF("VIX.XO Close = %g", VIX);
_TRACEF("VIX.XO REF(Close, -1) = %g", Ref(VIX, -1));
Then apply that code to Analysis and setting to Daily periodicity as well as enable Pad&align and insert SPY as reference symbol. Click OK. Select VIX.XO as analysis symbol. Set Apply to: Current, Range: All quotes and run Scan.

Then after Scan being finished apply that same AFL to chart.
If SPY is selected symbol it should show VIX data of same day as of SPY.
As aside: Analysis can be saved as project file. Project file can be run via batch.

BTW, There does not need to be fixed anything in regards to Foreign functions.
As aside posted time frame functions code was not quite correct. Rather this way.
SetForeign("VIX.XO");
TimeFrameSet(inDaily);
dailyClose = C;
prev_dailyClose = Ref(Close, -1);
TimeFrameRestore();
expandmode = expandFirst;
dailyClose = TimeFrameExpand(dailyClose,inDaily,expandmode );
prev_dailyClose = TimeFrameExpand(prev_dailyClose,inDaily,expandmode);
_TRACE("!CLEAR!");
_TRACEF("VIX.XO Close = %g", SelectedValue(dailyClose));
_TRACEF("VIX.XO REF(Close, -1) = %g", SelectedValue(prev_dailyClose));
But don't use it as you want to apply Daily Chart Interval.