I'd like to work with raw tick data and naturally this data is unevenly spaced (for example, a couple of quotes are at the same second etc.)

For example

10:12:35 - 14.44
10:12:35 - 14.45
10:12:35 - 14.47
10:12:36 - 14.46
10:12:36 - 14.49
10:12:37 - 14.50

My question is regarding how to set this data to "fixed" intervals for valid math calculation. Though I read here couple of suggestions on what should be done, I'm not sure its clear to me:

  1. Do I have to manipulate the raw data to have "clean" timestamps as the x-axis to work with common technical indicators?

  2. Or can I refer to the index as the x-axis (and just ignore the timestamp)? Can I look at it as a "stream" of ticks to anaylze?

  • 6
    $\begingroup$ If that is how your data looks, it looks more like trades than quotes. For it to be a quote you need a bid and an ask. $\endgroup$ – Louis Marascio May 5 '13 at 0:30

If you just want to run some simplistic technical analysis on quotes, then select the last quote for each unique timestamp. That will ensure that you don't have duplicate timestamps. If you must have it evenly spaced (i.e. no gaps from one second to another), then you can reuse the previous quote to fill-in the missing value.

  • $\begingroup$ 1. so in anyway, you don't recommend just to use the "stream" of ticks (and ignore the timestamp)? to refer the X-Axis as the tick index (tick 1, tick 2, tick 3) and the Y-Axis as its value? $\endgroup$ – user1025852 May 4 '13 at 17:53
  • $\begingroup$ 2. I wonder how all the platforms address this issue (metatrader etc.) - all those platform that have technical indicator out-of-the-box $\endgroup$ – user1025852 May 4 '13 at 17:54
  • $\begingroup$ BTW - it's not "no gaps from one second to another" it's the oppisite - I have multiple quotes per second.... $\endgroup$ – user1025852 May 4 '13 at 17:56

To help you understand why you need to follow recipes (like chrisaycock's) just have a look at your tick data. You will find ticks clustered at some points in time while they seem scarce at others.

If you proceed with your recipe 2, you will lose those clusters of activity and stretch them out. In periods of low activity you will condense the market.

Most indicators you mentioned will expect to work over a window of time, simply because the results are so much more meaningful. In theory, you could apply the same algorithms to stretched or condensed indexed ticks, but the results will also be valid for those periods.

That means for a cluster of activity that makes the price jump from X to X+10 within 1000 ticks but only one second of time your indicator might tell you to sell on the 400th tick and buy on the 800th. But to implement this you would have to execute a round-trip within less than a second.

Now also this indicator's results are less comparable. Because in a period of low market activity the indicator might give you the same result (sell on 400, buy on 800), but now it's stretched over, say, hours, and it's much more likely that you can realise this trade.


It really depends on what you're trying to do, a solution as simple as agging the data to x-sec OHLC bars may suffice and from the sounds of things that's what you need. Now if you need to work with order book dynamics then tick data is fairly crucial, then what I'd do for analysis is reconstruct the orderbook from the ticks then just take snapshots of the book (again depends on your requirements).

  • $\begingroup$ I agree with ast4. And if you're analyzing at the tick level then it seem like you would want to analyze bid size, ask size and trade price in addition to bid price and ask price... $\endgroup$ – Al De Los Santos May 30 '13 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.