See comments in sample code. Is there any reason that rawtime() of an external series would work differently if the chart interval is tick-based rather than minute-based? If not, this is a bug.
Here is some sample output, running on one-minute and 20T charts. It was run pre-market, so we didn't get a trade every second, so the output from the one-minute chart does not show sequential seconds, but it does show that rawtime() of the one-second series does NOT change on the 20T chart as frequently as it does on the one-minute one.
PHP Code:
// as tested on ES #f, 10.2.1391
// If a one-second series is created on a one-minute chart and the
// the rawtime(of one-second series) value is printed each time it changes (for current bars) the value is seen to increase
// one-by-one (assuming market is trading normally, ie more often than once per second).
// This is expected.
// If the same one-second series is created on a tick chart (610T and 100T tested) then the rawtime does NOT change sequentially.
// It only seems to update when the chart bar changes (at BARSTATE_NEWBAR). This is not expected.
//
// getBarStateInterval(one-second interval) also seems broken in a similar way
// run one of these on both a one-minute chart and a, say, 610T chart, to see the
// missing prints from the 610T chart compared with the one-minute chart.
var mxOneSec = null;
var mnRawtimeStart = null;
var mnRawtimeLast = null;
function main() {
if (getBarState() == BARSTATE_ALLBARS) {
debugPrintln("Testing faulty timestamps in external seeries on tickcharts (tested for ES #F, compare 1min and 610T charts)");
debugPrintln("Chart Symbol & interval = " + getSymbol() + "," + getInterval() );
mxOneSec = inv("1S");
return;
}
if (!isLastBarOnChart()) {
return;
}
if (mnRawtimeLast == null) {
mnRawtimeStart = rawtime(0,mxOneSec);
mnRawtimeLast = rawtime(0,mxOneSec);
return;
}
if (getBarState() == BARSTATE_NEWBAR) {
debugPrintln("\nNew chart bar on inv = " + getInterval() + "\n");
}
if (mnRawtimeLast != rawtime(0,mxOneSec)) {
mnRawtimeLast = rawtime(0,mxOneSec);
debugPrintln("\nNew one-second rawtime() on inv = " + getInterval() + ", = " + (mnRawtimeLast - mnRawtimeStart));
} else {
debugPrint("."); // each tick, to ceck activity
}
return;
}
PHP Code:
New one-second rawtime() on inv = 20T, = 142
..
New one-second rawtime() on inv = 1, = 131
.......
New one-second rawtime() on inv = 1, = 132
.
New one-second rawtime() on inv = 1, = 136
...
New one-second rawtime() on inv = 1, = 139
.............
New one-second rawtime() on inv = 1, = 140
...
New one-second rawtime() on inv = 1, = 143
.
New one-second rawtime() on inv = 1, = 146
.
New one-second rawtime() on inv = 1, = 149
New chart bar on inv = 20T
New one-second rawtime() on inv = 20T, = 161
..
New one-second rawtime() on inv = 1, = 150
.
New one-second rawtime() on inv = 1, = 152
.........
New one-second rawtime() on inv = 1, = 153
.............
New one-second rawtime() on inv = 1, = 155
..........
New chart bar on inv = 20T
New one-second rawtime() on inv = 20T, = 168
New one-second rawtime() on inv = 1, = 156
.
New one-second rawtime() on inv = 1, = 159
.
New one-second rawtime() on inv = 1, = 160
...
New one-second rawtime() on inv = 1, = 163
........
Comment