The Shanghai crude oil futures market exudes distinct speculative attributes, underscoring the pivotal significance of precise price forecasts. Accurate forecasting of Shanghai crude oil futures prices assumes vital importance for investors to optimize their portfolios profitably, for producers to mitigate production risks in the crude oil spot market, and for providing cogent decision-making support to government entities. This study implements a groundbreaking unbiased structural forecasting for Shanghai crude oil futures' open-high-low-close (OHLC) prices leveraging the Transformer framework coupled with the model-driven and penalty term-based loss function designs. Based on OHLC forecasts, this study devises three intraday trading strategies. Notably, our results evince that the forecasting accuracy of the Transformer outperforms the Naïve method, vector autoregression (VAR) and vector error correction model (VECM), multiple linear regression (MLR), support vector regression (SVR), and long short-term memory (LSTM) neural network when applied to different temporal granularities of Shanghai crude oil futures OHLC data. Furthermore, the three proposed intraday trading strategies exhibit higher annualized return rates and Sharpe ratios, alongside lower maximum drawdowns and standard deviations of returns in comparison to the conventional close-to-close strategy relying solely on the close price. Remarkably, the forecasting process and intraday trading strategies explicated in this study can equally apply to other futures products in the energy sector, including electricity, coal, and natural gas.