Hi all, I am a newbie trying to backtest some very simple pairs trading strategy. My strategy is (non-HFT or intraday): Based on close prices, if stock A - stock B > entry threshold, I will go short A and long B and I will hold them for a few days until stock A - stock B < exit threshold. All trades are upon closes. But what happens if the two stocks ex-Dividend on different dates? Lets say today is stock B ex-Dividend day, stock B drops in prices, stock A - stock B > entry threshold is satisfied and I enter long B and short A at close. Then tomorrow is stock A's ex-Dividend day, stock A drops in prices, stock A - stock B < exit threshold is satisfied and I exit the positions at close. So my newbie questions are: (1) shall I use dividend adjusted stock prices to do the historical backtest or not? (2) I am short A when A goes on ex-Dividend, what happens to the dividend? Please help me clear my thoughts. Thank you!