In course of the energy transition, the growing share of Renewable Energy Sources (RES) makes electricity generation more decentralized and intermittent. This increases the relevance of exploiting flexibility potentials that help balancing intermittent RES supply and demand and, thus, contribute to overall system resilience. Digital technologies, in the form of automated trading algorithms, may considerably contribute to flexibility exploitation, as they enable faster and more accurate market interactions. In this paper, we develop an integrated algorithmic framework that finds an optimal trading strategy for flexibility on multiple markets. Hence, our work supports the trading of flexibility in a multi-market environment that results in enhanced market integration and harmonization of economically traded and physically delivered electricity, which finally promotes resilience in highly complex electricity systems.