This paper presents the Anytime Stochastic Conflict Detection and Resolution system (ASCDR), which automatically identifies conflicts between multiple aircraft and proposes the most effective solution 4D trajectory considering the available computation time. The system detects conflicts using an algorithm based on axis-aligned minimum bounding box and resolves them cooperatively using a collision-free 4D trajectory planning algorithm based on a roundabout fast initial solution and a stochastic optimization technique named Particle Swarm Optimization (PSO) to modify the 4D initial trajectories of the aircraft with an overall minimum cost. Moreover, an anytime approach using PSO is applied because determining optimal trajectories with short time intervals in the flight phase is not feasible. Thus, trajectories whose quality improves when available computation time increases are yielded. The method could be applied to Medium-Term and even Short-Term Conflict Detection and Resolution depending on the look-ahead times. The method has been validated with simulations in scenarios with multiple aerial vehicles in a common airspace.