Electricity price forecasting (EPF) is important for energy system operations and management which include strategic bidding, generation scheduling, optimum storage reserves scheduling and systems analysis. Moreover, accurate EPF is crucial for the purpose of bidding strategies and minimizing the risk for market participants in the competitive electricity market. Nevertheless, accurate time-series prediction of electricity price is very challenging due to complex nonlinearity in the trend of electricity price. This work proposes a mid-term forecasting model based on the demand and price data, renewable and non-renewable energy supplies, the seasonality and peak and off-peak hours of working and nonworking days. An optimized Gated Recurrent Unit (GRU) which incorporates Bagged Regression Tree (BTE) is developed in the Recurrent Neural Network (RNN) architecture for the mid-term EPF. Tanh layer is employed to optimize the hyperparameters of the heterogeneous GRU with the aim to improve the model's performance, error reduction and predict the spikes. In this work, the proposed framework is assessed using electricity market data of five major economical states in Australia by using electricity market data from August 2020 to May 2021. The results showed significant improvement when adopting the proposed prediction framework compared to previous works in forecasting the electricity price.