A real-time optimization strategy can provide any system with a considerable boost in performance on the fly, which in real-world applications can be translated to lower energy consumption or higher efficiency. This study investigates the particular case of using real-time optimization to improve wing aerodynamic performance with a dynamically activated deflectable leading edge. Its activation aims to minimize drag and maximize lift and is governed by real-time and gradient-based optimization. An extension to a classic method is suggested to enhance gradient estimation accuracy. Experimental data are obtained at a Reynolds number of 2.0×105 with the wing fixed at five positions. For each of these positions, optimal leading-edge deflections are found. The results indicate that deflecting the leading edge has a negligible impact on drag and lift before the stall onset. However, the reduction in the pitching moment cannot be ignored. When the wing is experiencing a proper stall, the movable leading edge yields remarkable enhancements, with the lift being approximately raised by 45% together with a substantial increase in the critical angle of attack. The findings highlight the potential of real-time optimization in experimental aerodynamic studies, reinvigorating its application in improving aircraft performance.