Sounds a good idea. BUT, sorry always some buts. When I do my calculations for CG I look at my overall position for nett CG across all trades and my taxable income. Sometimes I am looking for the minimum CG, sometimes I am removing older cheap shares with a lot of embedded CG in them.
My target is to maximise my income while keeping my taxable income around the tax free threshold. So on this basis I would not use your solution as it does not cater for this scenario. However doesn't detract from what you have done and its usefulness.