The high potential for implementing demand management approaches across multiple objectives has been significantly enhanced. This study proposes a cooperative energy management strategy based on the end-user sharing of energy. The proposed method promotes the intelligent charging and discharging of EVs to achieve vehicle-to-anything (V2X) and anything-to-vehicle (X2V) operating modes for both integrated and nonrenewable residential applications. These sharing modes have already been discussed, but resolution approaches are applicable to a specific use case. Other application cases may require additional metrics to plan the fleet of electric vehicles. To avoid that problem, this study proposes the MIP method using a robust Gurobi optimiser based on a generic framework for cooperative power management (CPM). Moreover, the CPM ensures an overall target state of charge (SoC) at leaving time for all the vehicles without generating a rebound peak in total grid power, even without introducing photovoltaic power. Two different methods are proposed based on the flow direction of the EV power. The first method only includes the one-way power flow, while the second increases the two-way power flow between vehicles, operating in vehicle-to-vehicle or vehicle-to-loads modes. A thorough analysis of the findings of the proposed model was conducted to demonstrate the robustness and efficiency of the charging and discharging schedule of several EVs, favouring a sharing economy concept, reducing peak power, and increasing user comfort.