Based on intelligent bi-directional interactive operation of the smart grid, this paper investigates the flexible working mode and the optimal dispatch strategy for some kinds of loads including electricity storage. Using real-time electricity price, an optimal dispatch algorithm is proposed, which automatically shifts the load and generates electricity through an intelligent device. The proposed algorithm can guarantee that not only the users’ benefit maximization but also minimum of the peak-average ratio to achieve peaking-avoiding and valley-filling. Simulations are given to demonstrate the effectiveness of the proposed control method.