We report a dynamic programming algorithm which, given a set of efficient (or even inefficient) portfolios, constructs an optimal portfolio trading strategy that maximizes the probability of attaining an investor’s specified target wealth at the end of a designated time horizon. Our algorithm also accommodates periodic infusions or withdrawals of cash with no degradation to the dynamic portfolio’s performance or runtime. We explore the sensitivity of the terminal wealth distribution to restricting the segment of the efficient frontier available to the investor. Since our algorithm’s optimal strategy can be on the efficient frontier and is driven by an investor’s wealth and goals, it soundly beats the performance of target date funds in attaining investors’ goals. These optimal goals-based wealth management strategies are useful for independent financial advisors to implement behavioral-based FinTech offerings and for robo-advisors.