The devaluation takes place on the exDate - so there is no point in selling after the date as the dividend discount has already been taken into account. You would have to sell before the ex-date and then buy back on the ex-date. Or am I misunderstanding you now?