Abstract Direct transaction between the microgrid and distribution network is the most common market transaction mode. With the rapid expansion of business scale, industry development and diversification of service types, it is easy to cause problems such as opaque transaction data between users and easy tampering of transaction data. To improve the trading ability of the power market in the microgrid group, a game algorithm of power trading with microgrids based on a residual regression model is proposed. According to the power quality level and power sales strategy, a residual regression model is established to balance the characteristic quantity of electricity price. The quadratic function is used to solve the optimal selling strategy of power sales companies, and the threshold of equilibrium solution is analysed. The supply and demand model of the microgrid is established to optimize the decision variables of electricity price in power sales companies, and the fitness value is obtained by particle swarm optimization. The bidding strategy game model of the microgrid power sales company is constructed, and the rules of power transaction settlement are set to realize the transaction settlement between the microgrid and distribution network. The experimental results show that the electricity price is stable, the comprehensive income is high, the user income and cost income are moderate and the profit is high. Thus, it is proven that the proposed method is economical and effective, and the economy of electric energy use is guaranteed while fully considering the self-interest of microgrids.