Active distribution networks integrate distributed energy resources into traditional power grids, mainly guided by the intention of addressing climate change concerns. However, integrating distributed energy resources has introduced several challenges for traditional overcurrent protection, including variations in pre-fault and fault current magnitudes and bidirectional power flows. These challenges make it difficult to guarantee reliable protection of active networks in grid-connected and islanded modes. In response to the challenges posed by these new networks, this paper presents an adaptive protection approach that leverages local measurements and data clustering to identify the network operating states accurately. In this approach, reference relay coordination is obtained by considering all distributed energy resources that supply the network during the grid-connected operating state, providing optimal settings for each relay. Next, based on the current operating state, the adaptive relay pickup current is estimated based on local measurements, which is used to adjust the time dial setting of each directional overcurrent relay. The proposed approach is contrasted with the conventional relay, considering several operating states, including DER switching, grid-connected, and islanded modes, for single-phase and three-phase faults and several fault resistances, using the IEEE 34-node test feeder. The results demonstrate the proposal's high performance in avoiding relay miscoordination. Finally, the proposed approach is also simple and suitable for immediate implementation in existing digital relays, as it has a low computation burden and does not require communication systems.