Flock borrows heavily from the concepts used in pairs trading. However, instead of comparing two stocks at a time, flock compares each stock to the rest of the 'flock', and assumes that the stocks that have strayed from the flock the most will return the fastest.

There's no slippage modelling but there's enough profit there that the algo should survive slippage. To be sure you might be better off converting the algo to minute or second resolution and adding a position builder that uses limit orders instead of using the market open orders it is using now. That will give you more realistic results in backtesting and will address the slippage problem. You will also be able to build up a larger position by spreading your order out in time.

The algo does not perform well previous to the last two years, but it does seem to be in sync with current market dynamics.

All of the code is there but feel free to ask any questions you might have.

Use at your own risk.