0

I want to search through a large historical data set and look for unique patterns that may be there. Here is some psudeo-data for the purpose of this post:

data = [1,2,3,4,5,6,
        3,4,5,6,7,8,
        1,2,4,4,5,9,
        0,0,5,0,0,1,
        1,2,3,4,5,6,
        0,0,5,0,0,1,
        0,0,5,0,0,1,
        3,6,9,7,2,1,
        0,6,5,0,0,1,]

Editied dataset has been added Ultimately this will somewhat automated the process of setting up mechanical strategies (more info and an example can be found here http://www.quantifiedstrategies.com/3-day-low-in-etfs/) Is there a way to do this short of searching for every possible combination? It is not too hard to find the obvious ones, but there are more that could be found, it just takes way to long to do manually.

paperstsoap
  • 335
  • 4
  • 13
  • 1
    How long of patterns do you want to search for? Once they get longer than `len(data)/2` they are trivially unique. – River Jul 26 '16 at 14:34
  • @River I would like to keep them as short as possible. Ultimately once they are found, they will be a part of a nested for loop with if statements so the shorter the better. It would be nice to have more then needed, then make the call on how to cut it down for efficiency. What you suggested could be the max. – paperstsoap Jul 26 '16 at 14:38
  • 2
    Can you perhaps give a few example patterns from the above data? I want to make sure I'm interpreting what you're asking for correctly. – River Jul 26 '16 at 14:50
  • @River An example of what I would be looking for is a script that would indicate there is a pattern when idx[0] = 0, idx[2] = 5 then idx[5] = 1 and when idx[0] = 1, idx[3] = 4 then idx[4] = 4 etc. This would be somewhat equivalent to finding the 7 day low, then open high on a Monday type of scheme discussed in the link. Does that help any? – paperstsoap Jul 26 '16 at 15:33
  • I'm still not sure what you want. Can you give a concrete example based on `data` in your question? What is `idx` and where do your indexes/values come from? – River Aug 03 '16 at 14:19

0 Answers0