I needed this to save tick data in a form where our AI / ML prediction engine could access it. I needed the history but even more important I needed the something that could deliver new ticks to the prediction engine fast as they became available. I cheated with this utility and open the file in shared mode. This allows my Lua code read new lines as they become available as if the file were a more traditional pipe. Not perfect but I wanted to keep the code in cAlgo as small as possible so I can change brokers easily in the future. It only delivers about a year of back tick data but that is still over a gig of data.
A version of this code is used in our Production Forex Trading by our Forex Prediction Engine.