Summary The optimal coordination of overcurrent relays is an important task in the field of power system protection. Traditionally, this problem is solved with the assumption of the grid being in maximum or minimum loading and dominant topology, that is, the topology in which the grid operates most of the time. However, the grid condition changes during the time because of many reasons. In this paper, by sampling voltage and load current phasors at the high-voltage (HV) bus of a substation, an online method, based on an evolutionary algorithm, is introduced to estimate the grid's Thevenin equivalent viewed from the HV bus. Then, the Thevenin equivalent together with the connection status and short-circuit model of local power transformers and local distributed generations are used to estimate three-phase short-circuit currents in the existing condition of the grid. Finally, these fault currents are used for adaptive optimal coordination of overcurrent relays of the HV substation, such that the optimal coordination of the relays is preserved in all the grid conditions. Case studies, performed on the overcurrent protection of a typical 230/20 kV substation connected to a 9-bus grid, prove desired performance of the proposed online adaptive setting method. Furthermore, this method needs no telecommunications and represents a step toward self-adjusting overcurrent relays. Copyright © 2016 John Wiley & Sons, Ltd.