A method of automatically milking a dairy animal, in particular a cow. The method comprises: a) the step of activating the teat cup (2) for milking the teat b) the step of measuring (10) a milking parameter during milking the teat during step a) for obtaining a value of the milking parameter, and c) the step of deactivating the teat cup when a deactivation threshold has been reached. The deactivation threshold is determined at least partially with the aid of the value of the milking parameter. The method further comprises the step of storing in a memory of a computer (13) a number of ranges of average milking parameter values, and of storing in a memory of the computer (13) a respective threshold milking parameter value corresponding with a certain range.