The RPL routing protocol is designed to respond to the requirements of a large range of Low-power and Lossy Networks (LLNs). RPL uses an objective function (OF) to build the route toward a destination based on routing metrics. Considering only a single metric, some network performances can be improved while others may be degraded. In this paper, we present a flexible Objective Function based on Expected Transmission Count (ETX), Consumed Energy and Forwarding Delay (OF-ECF) built on a combination of metrics using an additive method. The main goal of this proposed solution is to balance energy consumption and minimize the average delay. To improve the reliability of the network, a flexible routing scheme that provides the diversity of paths and a higher availability is presented. Simulations results show that the new objective function OF-ECF outperforms the OF-FUZZY, and the standards OF0 and MRHOF. In terms of network lifetime and reliability.