The calibration problem involves the gradient of the objective function with respect to the Heston parameters. A finite difference approximation of the gradient has a tendency to create artificial numerical issues in the calibration. It is a much better idea to rely on automatic differentiation techniques. For example, the tangent mode of algorithmic differentiation may be applied using dual numbers in a straightforward manner. Alternatively, Cui et al. give explicit formulas for the analytical gradient. The latter was obtained by introducing an equivalent but tractable form of the Heston characteristic function.