Bug in first bar of week construction

Posted By: Zheka

Bug in first bar of week construction - 03/10/18 14:40

JCL,

with Weekend=1, the very first bar of the week is constructed incorrectly (1 M1 shift). The next bars are ok.

v 1.79.7

Attached picture Zorro_1stbar_bug_weekend1.PNG
Posted By: jcl

Re: Bug in first bar of week construction - 03/12/18 09:17

Thanks, we'll look into this. It is probably a rounding error again.
Posted By: Zheka

Re: Bug in first bar of week construction - 03/12/18 14:11

Quote:
It is probably a rounding error
It starts and ends 1 min earlier than it should.
Posted By: Zheka

Re: Bug in first bar of week construction - 03/17/18 14:55

JCL,

In 1.80.2 the above-mentioned bug is fixed.

However, a new bug appeared!

The bar is just skipped/not constructed despite data exist in the database, which screws further frame construction.
I suspect the reason is its o-h-l-c are all the same, but that's the way it indeed happened.

Attached picture Zorro_barconstruction_bug_2.PNG
Posted By: jcl

Re: Bug in first bar of week construction - 03/19/18 10:40

We have not yet fixed or looked into it. Only the timestamp rounding was made slightly more restrictive in 1.80.2, for avoiding a bit more rounding errors. But we cannot round too much, or else we lose precision.

O-H-L-C all the same is normal and not a bug.
Posted By: Zheka

Re: Bug in first bar of week construction - 03/19/18 11:58

What is meant by "rounding"?
These are historical M1 data with exact timestamps, already rounded to a whole minute.
Anyway, it has to be verified and confirmed that the first bar of the week starts on time and is of duration specified by BarPeriod/BarOffset.

Quote:
O-H-L-C, all the same, is normal and not a bug.
Sure. I did not imply it is.

The bug is that a bar is not constructed/is skipped, despite data exist in a database.

Please have a look at the screenshot.
Posted By: jcl

Re: Bug in first bar of week construction - 03/19/18 17:49

Sorry, I meant "not causing a bug".

Rounding applies a small time delay to any timestamp for avoiding rounding errors like this one that you reported here.
Posted By: Zheka

Re: Bug in first bar of week construction - 03/24/18 13:48

JCL,

in 1.80.6 this bug is still present.

I can understand rounding in live trading where timestamps are determined on-the-go, but timestamps of historical data are unambiguous...

If ZHistoryEditor displays raw data correctly, then - what's the problem?
Such basic functionality should be reliable...One way or another.
Posted By: jcl

Re: Bug in first bar of week construction - 03/27/18 07:45

Rounding is needed for any data series that is sampled in fixed time intervals. Since the timestamps have random fluctuations and can end up right or left of a minute boundary, trading platforms round them down by applying a time offset. Has nothing to do with live trading. - Update: We could confirm the rounding issue. It will be fixed in the next release. A bug with a skipped bar could not be reproduced. If you think you got a wrong bar, please post that script here or send it to support.
Posted By: Zheka

Re: Bug in first bar of week construction - 04/02/18 12:27

Yes, I embarked on exporting data from IB/ importing into Zorro myself and did stumble on this very issue: all bars got shifted until I added 100ms to the timestamps...
But this has probably more to do with the exactness of float/double representation, isnt' it?

It probably makes sense to have different rounding algorithms for historical data and live data.

Quote:
If you think you got a wrong bar, please post that script here or send it to support
How can a script possibly influence bar formation by Zorro?

I would rather retest after the basic rounding fix is implemented and then report again.
© 2024 lite-C Forums