It's surprising than anybody except Faisal2202 for the Dollar-Cost Averaging formula has come to correct your mistake.
Thanks for noticing and admiration, it makes me happy
By the way, you also corrected the formula for ROI which no one noticed yet, I also did not, but thanks to you. Op should edit the post accordingly unless he/she has a better explanation.
@OP had given formulas but sadly most of the given formulas were wrong and were corrected by Faisal2202 and Saint-loup, -cut-
Not a big issue as I don't see anyone using the formulas for their profile or trading purpose and making a loss but I do agree with you that we should do proper research before making a topic, but sometimes when the post is above our understanding, we make mistakes in them, I also made many topics till now, in which I was wrong sometimes, but corrected by other members. Thus learned new things in the correct way.
OP might be using this formula for I don't know how much time, but due to this forum he got corrected like I was, so we should not worry that much (to OP) about the fact that we are being corrected publically, instead we should focus on the fact that we are being taught for free. My teacher used to say, even if you have to bear the insult, bear it, but do learn from others. I don't know how you (OP) fell about this but I was bashed by seniors many times but never felt insulted (I hope you won't mind my words and learn from it).