A software expert has created an algorithm that detects stock market trends with shocking accuracy.