Added the code to generate the new price based on the history of price changes.