Reactive power compensation of distribution network is an important method to improve power quality and voltage stability, while reducing the power loss of the distribution network. In this paper the objective function is built to minimize all the costs which include power loss costs and investment of the dynamic reactive power compensation device divided into each year. The actual operation of the distribution network is simulated considering light, normal and heavy load operation conditions. Bacterial colony chemotaxis (BCC) algorithm is used to determine which nodes to install the compensation devices. The calculation of reactive power compensation is done with the back/forward sweep algorithm adapting to the radial distribution system. In order to compensate three different load conditions separately, the fixed part and the switching part of the dynamic reactive power compensation device are used. This method applies to 28-node system, the result demonstrates that the method is feasible and effective.