This book investigates the application of promising machine learning techniques to address two problems: (i) how to find profitable pairs while constraining the search space and (ii) how to avoid long decline periods due to prolonged divergent pairs. It also proposes the integration of an unsupervised learning algorithm, OPTICS, to handle problem (i), and demonstrates that the suggested technique can outperform the common pairs search methods, achieving an average portfolio Sharpe ratio of 3.79, in comparison to 3.58 and 2.59 obtained using standard approaches. For problem (ii), the authors introduce a forecasting-based trading model capable of reducing the periods of portfolio decline by 75%. However, this comes at the expense of decreasing overall profitability. The authors also test the proposed strategy using an ARMA model, an LSTM and an LSTM encoder-decoder.