Backtesting pitfalls and how to avoid them