The study focused on the design of an advanced algorithm for the optimal sizing of protection systems against atmospheric discharges in architectural structures, applying the rolling sphere method. This technique facilitated the incorporation of user-specified parameters through an advanced graphical interface. The methodology began with the exhaustive accumulation of data relevant to the project. Risk indices were estimated through sophisticated risk analysis software applications. If adjustments were required, the process continued; If not, the building was considered to be adequately secured. The ground resistivity was evaluated according to IEEE Std. 81, and the rolling sphere method was implemented according to IEC 662305-3. The grounding systems were configured in accordance with IEEE Std. 142 and IEEE Std. 80. To analyze the interaction of electrical discharges with the protected building, the electrical equivalents of elements such as meshes, fused copper rods were computed. , and conductors positioned horizontally and vertically. Using these data, a model was built in ATPDraw, interconnected with Python for the generation of graphical representations of the current waves in the different protection subsystems. To conclude and corroborate the effectiveness of the process, the risk indices were reevaluated. The validation of the algorithm was achieved by minimizing the margin of error to insignificant levels by incorporating standardized data proposed by organizations such as IEC and IEEE, thus confirming the precision of the designed algorithm