Practitioners allocate substantial resources to technical analysis whereas academic theories of market efficiency rule out technical trading profitability. We study this long-standing puzzle by applying a diverse set of machine learning algorithms. The results show that an investor can find profitable technical trading rules using past prices, and that this out-of-sample profitability decreases through time, showing that markets have become more efficient over time. In addition, we find that the evolutionary genetic algorithm’s attitude in not shying away from erroneous predictions gives it an edge in building profitable strategies compared to the strict loss-minimization-focused machine learning algorithms.