Level 3 AI in trading · Part 2/8

Data and Bars: the Sample Decides

Before a model can learn anything, the continuous stream of trades has to become a table of rows. That decision is nearly always made implicitly – and it matters more than the choice of model.

The problem with time intervals

The default is the time bar: one row per minute, hour or day. But markets do not trade evenly across time. The first trading hour holds a multiple of the midday hour’s activity; around a central bank decision, more happens in minutes than otherwise in whole days.

12alysly.com
Below is trading activity through the day — anything but uniform. (1) Time bars cut the series into equal time slices: quiet phases produce many near-empty observations, hectic ones squeeze everything into a single bar. (2) Activity or dollar bars cut at equal traded volume instead: the slices differ in length but carry comparable information. Statistically, returns sampled this way are far closer to a normal distribution.

The consequence: quiet phases produce many nearly empty observations, hectic ones compress a great deal of information into a single row. For a model, the rows of the table are not comparable – some carry hardly any information, others too much.

This shows up statistically: returns from time bars are more skewed and considerably more fat-tailed than returns from activity-based sampling.

The alternatives

Tick bars. A new row after every n trades. This equalises the number of events but ignores their size – and since much order flow is now split into small child executions, the count is easily distorted.

Volume bars. A new row after every n units traded. Closer to economic activity than a raw count.

Dollar bars. A new row after every n units of currency traded. The key advantage over volume: after a large price increase, the same share count represents far more capital. Over long horizons, and through buybacks or issuance, dollar bars therefore stay comparable the longest.

The effect is unspectacular and effective: slices vary in length but each carries comparable information. Returns built from them sit closer to a normal distribution – which is precisely what almost every downstream method assumes.

Event-based sampling

One step further: do not sample at regular intervals at all, but only when something happened. A common criterion is cumulative movement crossing a threshold (a CUSUM filter). The model then sees only situations in which a decision would actually arise.

The side effect matters more than it sounds: the sample is smaller, but every row is relevant. Models trained on a hundred thousand rows of uneventful price action mostly learn to reproduce the normal state.

What this means in practice

For the pattern statistics of Level 2 there is an uncomfortable consequence: a study on daily bars does not measure the pattern, it measures the pattern plus the sampling decision. Two studies of the same pattern using different bar definitions are not comparable.

Anyone without tick data – which is the normal case – can at least keep the awareness: daily bars are a convention from the era of printed price lists, not a natural unit of the market.

Next

The next hurdle: price series are not stationary, but models need stationarity – without losing memory.