This paper addresses an integrated framework for the dynamic capacity withholding assessment of an independent system operator that determines the mid-term maintenance scheduling of generation companies and day-ahead scheduling of wholesale market participants. The main contribution of this research is that two dynamic capacity-withholding indices are proposed for mid-term and day-ahead scheduling of generation companies that estimate the dynamic capacity withholding opportunities of generation units in an ex-ante manner. The proposed framework is another contribution of this research that uses a four-stage optimization process that the system operator can detect and prevent the formation of withholding groups. The optimal maintenance scheduling from the generation companies viewpoint is assessed in the first-stage problem that considers different mid-term withholding opportunities. The optimal mid-term maintenance scheduling is carried out in the second-stage problem that recognizes and rejects the dynamic capacity withholding of generation companies. The optimal scheduling of day-ahead generation companies considering their dynamic capacity withholding is the third contribution of this paper that optimizes the scheduling of generation units for day-ahead horizon considering responsive loads. The proposed method is applied to 30-bus, 57-bus and 118-bus IEEE test systems. A full competition algorithm is also carried out to evaluate the competition states of generation companies. The proposed algorithm detected that the dynamic capacity withholding might lead to increase of nodal price by about 279.22%, 764.43%, and 851.2% for 30-bus, 57-bus, and 118-bus IEEE test systems with respect to the non-capacity withholding conditions, respectively.