Compound profits when account Doubles

Hi good traders
I have been looking all over the internet for an AFL backtest code that can compound profits when the account doubles .For example , we have a $10,000 account and we are trading 1 lot .And then the account doubles to $20,000 . So the next trade should be opened with 2lots . And when the $20,000 account doubles to $40,000 the next trade should be opened with 4lots and so on ... I have looked all over the internet for a prewritten code that can do this kind of compounding profits in backtest.I am not a very experienced coder ..I will be very pleased if experienced coders here and anyone who can help point me in the right direction .Thank you for your time and green pips to you ALL.