This study proposes an optimal control strategy for a transactive energy system integrated with the main supply grid. The power infrastructure of this transactive system includes an electrical microgrid integrated with renewable energy sources (RES), energy storage systems (ESS), and smart loads (SLs). Each SL comprises an electric spring (ES) in series with a noncritical load (NCL). The ES regulates the voltage and manages local demand, making it particularly suitable for microgrids with a high RES penetration. The load variations and stochastic nature of RES are modelled using time-varying profiles to facilitate scenarios that closely resemble real-world conditions. The control strategy uses a metaheuristic algorithm to coordinate the operation of SLs and ESS to minimise voltage fluctuations, reduce power losses, and optimise power exchange within the transactive system. Specifically, the Particle Swarm optimisation (PSO) algorithm is used and compared to the Grey Wolf Optimiser (GWO) and the Genetic algorithm (GA). The results show that PSO achieves significant improvements, reducing operating costs by 77.94%, voltage deviation by 50%, and active power losses by 14.54% compared to scenarios without ES support.