A method for computing the multigraded Hilbert depth of a module was presented in [16]. In this paper we improve the method and we introduce an effective algorithm for performing the computations. In a particular case, the algorithm may also be easily adapted for computing the Stanley depth of the module. We further present interesting examples which were found with the help of an experimental implementation of the algorithm [17]. Thus, we completely solve several open problems proposed by Herzog in [12].