Forecasting sales trends is a valuable activity for companies of all types and sizes, as it enables more efficient decision making to avoid unnecessary expenses from excess inventory or, conversely, losses due to insufficient inventory to meet demand. In this paper, we designed a personalized cost function to reduce economic losses caused by the excessive acquisition of products or derived from their scarcity when needed. Moreover, we designed an LSTM network integrated with Glorot and Orthogonal initializers and dropout to forecast sales trends in a lumber mill in Tamaulipas, Mexico. To generalize and appropriately forecast the sales of the lumber mill products, we optimized the LSTM network’s hyperparameters through a genetic algorithm, which was essential to explore the solution space. We evaluated our proposal in instances obtained from the historical sales of the five main products sold by the lumber mill. According to the results, we concluded that for our case study the proposed function cost and the hyperparameters optimization allowed the LSTM to forecast the direction and trend of the lumber mill’s product sales despite the variability of the products.