During its operation, a photovoltaic system may encounter many practical issues such as receiving uniform or non-uniform irradiance caused mainly by partial shading. Under uniform irradiance a photovoltaic panel has a single maximum power point. Conversely under non-uniform irradiance, a photovoltaic panel has several local maximum power points and a single global maximum power point. To maximize energy production, a maximum power point tracker algorithm is commonly implemented to achieve the maximum power operating point of the photovoltaic panel. However, the performance of the algorithm will depend on operating conditions such as variation in irradiance. Presently, most of existing maximum power point tracker algorithms work only in a single condition: either uniform or non-uniform irradiance. This paper proposes a new maximum power point tracker algorithm for photovoltaic power generation that is designed to work under uniform and partial shading irradiance conditions. Additionally, the proposed maximum power point tracker algorithm aims to provide: (1) a simple math algorithm to reduce computational load, (2) fast tracking by evaluating progress for every single executed duty cycle, (3) without random steps to prevent jumping duty cycle, and (4) smooth variable steps to increase accuracy. The performances of the proposed algorithm are evaluated by three conditions of uniform and partial shading irradiance where a targeted maximum power point is located: (1) far from, (2) near, and (3) laid between initial positions of particles. The simulation shows that the proposed algorithm successfully tracks the maximum power point by resulting in similar power values in those three conditions. The proposed algorithm could handle the partial shading condition by avoiding the local maxima power point and finding the global maxima power point. Comparisons of the proposed algorithm and other well-known algorithms such as differential evolution, firefly, particle swarm optimization, and grey wolf optimization are provided to show the superiority of the proposed algorithm. The results show the proposed algorithm has better performance by providing faster tracking, faster settling time, higher accuracy, minimum oscillation and jumping duty cycle, and higher energy harvesting.