The proper way to convert market data ticks to OHLC
After my email of:
I got this response from a long standing newsletter subscriber:
Super busy but my quick answer. A “bar” is just a collection of ticks of some kind. To build a “Minute” bar, you would collect ticks as they come in and store their values in the data structure of your choice. While building that collection you have you have to mark the O and C price and the H and L can change on tick as the structure fills. That data structure is usually an array of DateTimeOHLCV objects of some kind.HOWEVER, most commercial trading software or developer API’s allow you to import data and have bar structures built out already(as you know). If the person asking the question needs to program bars, they plan on building a trading system scratch and if you can do that you can build a List<> object with values, I would imagine as the tick data structure is the backbone..literally. It sounds like this person should be using trading software like NinjaTrader or TradeStation, ect.. – those are very flexable/extendable and can import data. But there is an API with common trading functionality to write higher level code against as well.Hope all is awesome!
There is a plethora of similar questions and answers at. Stackover Flow That’s where I’d start.http://stackoverflow.com/questions/17952082/converting-tick-data-to-ohlc-bars-using-r
NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!