My idea is: let's take last X prices. And look in all the history for a given instrument what were the most similar X prices in the past and what happened in the next Y prices. For example:
- Let's look at last 500 open prices on 1 minute chart
- Find the most similar 500 open prices in the historical data
- Check whether the price risen or fallen in the next 200 bars
Of course the challenge is: how to find the most similar piece of data from the past. My initial idea was rather trivial: take two data series and calculate an euclidean distance in each data point. If all the distances would be the same it would mean that the series are identical. However this approach wouldn't be very robust in presence of noise or for time shifted data...
So I implemented an algorithm called Dynamic Time Warping. It is a rather simple approach to determining time series similarity, but it gives good results for vast variety of different classes of time series data. I will not write about the algorithm itself, as it is well described in Internet. I tried two things (not going into calculation details):
- Finding one most similar pattern from the past.
- Finding many similar patterns and seeing whether there was a consistent behavior in directly subsequent data.
As for now I am parking this idea, even though I believe there is a lot of value in it... But to further explore it I would need to spent much more time to implement other similarity algorithms:
- more precise on varied datasets,
- much faster in calculation.
No comments:
Post a Comment