This margin post is too narrow to contain the complete answer to your question, but if you research time series prediction, it should give you a few starting pointers. Your problem is very complex and extremely hard to solve.
Comment on Re: guessing next number on roulette wheel