Network infrastructure sharing and mobile traffic offloading are promising technologies for Heterogeneous Networks (HetNets) to provide energy and cost effective services. In order to decrease the energy requirements and the capital and operational expenditures, Mobile Network Operators (MNOs) and third parties cooperate dynamically with changing roles leading to a novel market model, where innovative challenges are introduced. In this paper, a novel resource sharing and offloading algorithm is introduced based on a double auction mechanism where MNOs and third parties buy and sell capacity and roam their traffic among each other. For low traffic periods, Base Stations (BSs) and Small Cells (SCs) can even be switched off in order to gain even more in energy and cost. Due to the complexity of the scenario, we adopt the multi-objective optimization theory to capture the conflicting interests of the participating entities and we design an iterative double auction algorithm that ensures the efficient operation of the market. Additionally, the selection of the appropriate time periods to apply the proposed algorithm is of great importance. Thus, we propose a machine learning technique for traffic load prediction and for the selection of the most effective time periods to offload traffic and switch off the Base Stations. Analytical and experimental results are presented to assess the performance of the algorithm.