As power consumption continues to increase globally, power grids have begun to transform into a new form. The existing power grids consist of large-scale power generations based on fossil fuels and nuclear power as main energy sources and unidirectional energy transmission from centralized power plants (macrogrids) to energy consumers. However, due to the depletion of fossil fuels and the potential risks inherent in nuclear power generation, renewable energy such as solar energy and wind energy has been attracting attention as new energy sources and is replacing a lot of electricity production. Besides, many efforts are also being made to design a new type of power system by combining communication theory for more efficient power management. The next-generation power grid known as the smart grid is based on diverse energy sources, including renewable energy and aims to make efficient energy management using energy generation/consumption data through smart meters. In this context, microgrid has become an important building block in achieving this goal which is a small regional power system that integrates and coordinates energy generation and consumption in the region with or without the help of the macrogrids. Also, as the renewable energy generation facilities become small, energy consumers in the microgrid not only take the role of simply consuming energy but also take the role of generating their energy through small-scale power generation. We call these energy consumers prosumers, and this change allows the prosumers to trade energy with each other. The energy trade among prosumers is one of the important topics in the field of smart grid. Even though many works related to energy trading in microgrids have been carried out, most of the existing works suggest energy trading algorithms considering only the prosumers' energy status at the trading time or considering the prosumers' energy status after the trading roughly. In this dissertation, we propose energy trading systems for prosumers in microgrids based on forecasted energy generation and consumption as a time series for more realistic modeling. Predicting energy generation/consumption is difficult in general, so, we utilize a stochastic prediction of energy production/consumption, and we analyze the optimal actions of the prosumers based on the prediction. Then, through this analysis, we envision a system that coordinates the prosumers' actions and facilitates energy trading among prosumers.