Whenever a pair diverges from their mean, take positions in both the stocks (one long position and one short position). Gradually, when the prices of these stocks revert to the mean, exit the trades and book profit.
Pairs trading is a market-neutral strategy. A market-neutral strategy means that profit doesn't depend on the direction of market. As long as the prices of pair of stocks revert to mean, you make money.