The invention relates to a computer-implemented method for determining an AF complexity value. The method includes applying a template matching algorithm to an ECG signal to obtain a set of candidate deflections and identifying intrinsic deflections within the set of candidate deflections. The method further includes determining a number of intrinsic deflections and a number of far-field deflections within the set of candidate deflections, based on the identified intrinsic deflections, and determining the AF complexity value as a ratio between the number of far-field deflections and the number of intrinsic deflections.