The growing need for energy has led to the high installation of renewable energy resources (RES), especially wind turbines (WT) and photovoltaic (PV). Although these generations provide cheap power to the power grid, the uncertainty of their output power, along with other uncertainties of the power system, such as demands, leads to imbalances in the power system. The system operator requires a flexible energy portfolio of various distributed energy resources (DER) to cope with uncertainties and reduce imbalances. This study proposes a flexible optimal scheduling model for microgrid (MG) participation in the electricity market. Various DERs, including WT, PV, conventional generators (CG), and battery energy storage systems (BESS), are considered. Also, dynamic line rating (DLR) equipment is installed on the line connected to the upstream network. The simulation is implemented on the standard 33-busses IEEE. The flexibility indices (FI) for the line with DLR equipment and the CG are calculated to show the effect of DLR on flexibility. Then, the total system's flexibility index (SFI) is calculated by the provided weights and used to compare in different case studies, i.e., static line rating (SLR) and DLR models. Finally, the effect of RES penetration increments on the net profit of MG, total energy sold and purchased, unit flexibility, and the SFI are compared. The results demonstrate the effectiveness of the proposed model in improving net profit and the SFI.