Abstract Recent studies have extended the use of the stochastic Hamilton-Jacobi-Bellman (HJB) equation to include complex variables for deriving quantum mechanical equations. However, these studies often assume that it is valid to apply the HJB equation directly to complex numbers, an approach that overlooks the fundamental problem of comparing complex numbers when finding optimal controls. This paper explores the application of the HJB equation in the context of complex variables. It provides an in-depth investigation of the stochastic movement of quantum particles within the framework of stochastic optimal control theory. We obtain the complex diffusion coefficient in the stochastic equation of motion using the Cauchy-Riemann theorem, considering that the particle’s stochastic movement is described by two perfectly correlated real and imaginary stochastic processes. During the development of the covariant form of the HJB equation, we demonstrate that if the temporal stochastic increments of the two processes are perfectly correlated, then the spatial stochastic increments must be perfectly anti-correlated, and vice versa. The diffusion coefficient we derive has a form that enables the linearization of the HJB equation. The method for linearizing the HJB equation, along with the subsequent derivation of the Dirac equation, was developed in our previous work [V. Yordanov, Scientific Reports 14, 6507 (2024)]. These insights deepen our understanding of quantum dynamics and enhance the application of stochastic optimal control theory to quantum mechanics.