As I understand it, the point of setting setIntervalsBackfill() is to extend the indicator plot back as far as the chart ("Using this function will force the study to use the same number of days as the main chart interval, which will backfill the plot for external interval-based indicator to the beginning of the chart's data").
But it should still honour the times set by the time template, this was asked here although not confirmed by eSIgnal.
Bugs were noted in 10.1, presumably they are fixed (link ).
So now, after some hours pratting about of course, I find that with:
SPY, Exchange Timezone, Auto template (ie 9:30 to 16:00) and a 15 minute chart
that if an efs creates a 30minute series (of spy), and looks at the 30minute candles when it detects a new day in the chart candles, it finds that the 30minute candles do NOT also stop at 16:00 and continue at 9:30, but instead they deliver 24hour data.
Now infact this could be useful for adding 24hour extremes to a day-hous plot. But it's not what the behviour should be?
In this code example edit the "var mbBackFill = true;" line to see the difference caused by setIntervalsBackfill();
(this is 10.2)
But it should still honour the times set by the time template, this was asked here although not confirmed by eSIgnal.
Bugs were noted in 10.1, presumably they are fixed (link ).
So now, after some hours pratting about of course, I find that with:
SPY, Exchange Timezone, Auto template (ie 9:30 to 16:00) and a 15 minute chart
that if an efs creates a 30minute series (of spy), and looks at the 30minute candles when it detects a new day in the chart candles, it finds that the 30minute candles do NOT also stop at 16:00 and continue at 9:30, but instead they deliver 24hour data.
Now infact this could be useful for adding 24hour extremes to a day-hous plot. But it's not what the behviour should be?
In this code example edit the "var mbBackFill = true;" line to see the difference caused by setIntervalsBackfill();
PHP Code:
var mbOnceInit = false;
// run on a 15 min SPY chart with "Auto" time template
var mnSym30Interval = 30;
var mxSym30 = null;
var mbBackFill = true; // edit true / false to see difference
var mnDay = null;
function TwoDigits(n) {
var s = n.toString();
if (s.length == 1)
s = "0"+s;
return s; // ignore longer
}
function BarTimeString(nCandle,serSym) {
if (serSym == null) {
return TwoDigits(getMonth(nCandle))+"/"+TwoDigits(getDay(nCandle))+
"-"+TwoDigits(getHour(nCandle))+":"+TwoDigits(getMinute(nCandle));
} else {
return TwoDigits(getMonth(nCandle,serSym))+"/"+TwoDigits(getDay(nCandle ,serSym))
+"-"+TwoDigits(getHour(nCandle ,serSym))+":"+TwoDigits(getMinute(nCandle ,serSym));
}
}
function preMain() {
setIntervalsBackfill( mbBackFill ) ;
if (mbBackFill) {
setStudyTitle("Check effect of setIntervalsBackfill() on additional series when using Auto time template, tested for SPY, see efs debug Ouput");
} else {
setStudyTitle("Check effect of NOT SETTING setIntervalsBackfill() on additional series when using Auto time template, tested for SPY, see efs debug Ouput");
}
}
function main() {
if (!mbOnceInit) {
if (getInterval() == 30) {
mnSym30Interval = 60;
} else {
mnSym30Interval = 30;
}
mxSym = sym(getSymbol()+","+mnSym30Interval); // (inv("30") works the same way
mbOnceInit = true;
}
var nBarState = getBarState();
if (nBarState == BARSTATE_ALLBARS) {
mnDay = day(0); // chart candle day
}
if (nBarState == BARSTATE_NEWBAR) {
//debugPrint("NewBar: " + rawtime(0,mxSym) + "\n");
if (mnDay !=day(0)) { // chart day change
var nDayWas = mnDay;
mnDay = day(0);
// The day of the previous candle in the additional series should also be the previous day
if (nDayWas != day(-1,mxSym)) {
// WRONG day is found, may not have data yet
if (day(-1,mxSym) == null) {
} else {
debugPrint("At new chart day with first chart candle = "+BarTimeString(0,null)+
", UNEXPECTED day for previous candle in " + mnSym30Interval + " min series, previous candles are:\n");
for(var i=1;i<10;i++) {
// may not have data yet
if (close(-i,mxSym) != null) {
debugPrint(BarTimeString(-i,mxSym) + "\n"); // I see times like "90:, 08:30, 08:00 etc, ie not the proper "Auto" template.
}
}
}
} else {
debugPrint("At new chart day with first chart candle = "+BarTimeString(0,null)+
", expected day for previous candle in " + mnSym30Interval + " min series is found\n");
}
}
}
}