I want to test a cointegration pair trading algorithm, but I want it to test accross multiple pair. How can I input (passing by parametesr) some equities pairs.

1 - Stock_1 vs Stock_2 => Run backtest  1 => Get Result 1
2 - Stock_1 vs Stock_3 => Run backtest  2 => Get Result 2
N - Stock_N vs Stock_N+1 => Run backtest  => Get Result N

And then, base on on the result, pick the best one.,