Formulae to simulate earnings/losses of a volatile stock
I would like some formulae to simulate what would happen with the long-term accumulated earnings or losses with a volatile stock if I say I want my worth of shares at each point in time to stay constant at e.g. $10,000 plus/minus some suitable percentage, while the share price is going up and down.
Thus whenever the share rises above +x% I must sell off some, and when it falls below -y% I must buy some more, to make the total value stay roughly constant.
Including commission fees and capital gain tax, of course.
I guess this is similar to what S&P 500 uses to keep each stock at a roughly constant percentage, but I want a roughly constant value.
Surely, such calculations already exist, although I couldn't find them. To be honest, I think I should expect it to be better to just leave all the shares untouched for ten years or so. Or would indeed "constancy trading" be better in the long run? Whatever that may be, I'd still like to find the formulae for the beauty of formulae as such.
Thanks in advance!