1. Introduction
Electricity price forecasting (EPF) is a critical tool for decision-makers in modern liberalised power markets. Short-term price predictions help generators and retailers optimise their bids, enable large consumers to plan energy utilisation, and are of increasing importance for energy storage operators seeking to maximise arbitrage profits. By anticipating price trends up to a week in advance, battery storage and pumped-hydro facilities can schedule charge/discharge cycles to buy electricity when it is cheap and sell when it is expensive, thereby improving economic returns. More broadly, accurate forecasts enhance risk management and grid stability [
1]. At the same time, the literature on EPF has emphasised the need for objective and reproducible comparative studies using common datasets, robust evaluation protocols, and statistical significance tests to assess whether the superior performance of one model over another is meaningful [
2].
Day-ahead electricity markets—where prices for each hour of the next day are determined via auctions—have been extensively studied in the forecasting literature [
2,
3]. In contrast, the week-ahead horizon (i.e., forecasting hourly prices 7 days in advance) has received less attention, despite its practical importance for decisions whose lead time exceeds a single day: maintenance and outage scheduling, weekly fuel and CO
2 procurement and hedging, position-taking on weekly products, and multi-day storage and battery dispatch. The day-ahead auction remains the settlement venue for each individual day; the 168-h forecast is therefore a planning input that informs these multi-day decisions rather than a substitute for the next-day bid. Moreover, it is worth highlighting that week-ahead forecasting is inherently challenging as it must capture longer-term trends and patterns (weekly seasonality, future-day weather events) while remaining sensitive to intra-day price dynamics.
Spain’s electricity market provides a particularly instructive case study. Spain, in fact, operates a marginal-cost-based day-ahead market under the Iberian Energy Market (Mercado Ibérico de Energía, MIBEL) framework, and the clearing price is set by the marginal generator in each hourly auction (i.e., the last accepted unit, at the given marginal cost). Under normal conditions, gas-fired combined-cycle gas turbines (CCGTs) frequently occupy this marginal position, as they offer the highest variable costs among the dispatchable technologies.
This market structure has become increasingly important as the penetration of renewable energy started to accelerate exponentially. According to
Red Eléctrica (Alcobendas, Spain), the Technical System Operator in Spain, renewable generation accounted for 42%, 50.3%, and 56.8% of Spain’s national electricity production in 2022, 2023, and 2024, respectively. The Iberian merit order is increasingly characterised by a large block of low-marginal-cost wind, solar, and hydro generation, with CCGTs and open-cycle gas turbines (OCGTs) often acting as swing technologies and, in many hours, as key determinants of the market-clearing price under normal and high-demand conditions [
4,
5]. It is worth noting that, although hard coal is shown in the merit-order schematic for completeness, coal-fired generation has been almost entirely phased out of the Spanish system since 2020–2021, with the remaining units retired by 2025; coal therefore plays a marginal role in the period covered by this study.
This market structure links Spanish wholesale prices to external fuel-price shocks, especially in periods when gas-fired thermal units frequently set the marginal price, although the strength of this link varies over time with renewable output, hydro conditions, and interconnection flows. That sensitivity became particularly evident during the gas-price crisis of late 2021 and 2022, when the surge in international natural-gas prices following the outbreak of the Russia–Ukraine conflict was rapidly transmitted to wholesale electricity prices [
6]. Average Spanish wholesale prices in Q4 2021 exceeded 200 €/MWh, more than three times the Q4 2018 level, and hourly prices in March 2022 reached values as high as 700 €/MWh [
5,
6]. More recent disruptions to global LNG flows—notably the 2026 Strait of Hormuz crisis, which removed close to 20% of global LNG supply from the market and pushed European wholesale gas prices to their highest levels since early 2023 [
7]—are a further reminder of the continued exposure of gas-dependent European power markets to LNG supply shocks, even though Spain’s high renewable share and large regasification capacity provide partial insulation. As such episodes post-date the 2020–2025 sample analysed here, they are noted only as contextual motivation rather than as evidence within this study. Such episodes highlight both the economic relevance and the intrinsic difficulty of electricity price forecasting in Spain, particularly at the week-ahead horizon, where models must remain informative under structurally different and highly volatile market conditions.
With this scenario in mind, the present manuscript investigates week-ahead electricity price forecasting in Spain’s day-ahead market with two complementary aims. First, it benchmarks a set of statistical, machine-learning, and deep-learning models under a common rolling-origin evaluation protocol. Second, it examines how forecast performance is shaped by exogenous drivers that can be interpreted through the Iberian merit-order mechanism, with particular attention to the roles of thermal generation, renewable output, and weather conditions.
The contribution of the paper therefore extends beyond a pure forecasting comparison. The novelty does not lie in the forecasting models, which are standard, nor in the feature-ablation technique, which is common in machine learning, but in their application to the MIBEL week-ahead problem under a leakage-controlled protocol and, above all, in the economic interpretation of the resulting feature importance through the merit-order mechanism. More specifically, the study brings together five elements that are usually addressed separately in the literature: (i) a statistical characterisation of the 2020–2024 Spanish day-ahead price series; (ii) a benchmark comparison of nine forecasting models under a common rolling-origin protocol; (iii) an AOI/LOO analysis of the contribution of key exogenous variables; (iv) a controlled comparison of alternative weather-input scenarios; and (v) a rolling backtest of a battery arbitrage strategy under 24 h and 168 h receding-horizon optimisation.
The remainder of the paper is organised as follows.
Section 2 introduces the microeconomics of marginal pricing and discusses the role of gas-fired generation in setting the clearing price, while
Section 3 surveys the relevant EPF literature. The 2020–2024 Spain day-ahead price series is then characterised in
Section 4, and
Section 5 describes the data sources and the preparation steps used in the rest of the paper.
Section 6 sets out the eight-stage pipeline together with the model architectures and the evaluation protocol adopted. The forecasting results themselves are reported in
Section 7, and
Section 8 presents the battery-arbitrage backtest.
Section 9 interprets the combined findings,
Section 10 discusses the scope of the study and its main limitations, and
Section 11 concludes the paper with practical guidance and future research directions.
7. Results and Analysis
7.1. Model Performance Comparison
Figure 5 presents the distribution of weekly MAE across all 50 weekly rolling forecast windows for every model considered, including the two naïve baselines and the LEAR statistical reference; this stage serves as an initial screen on a common endogenous feature set (the feature groups active at each stage are mapped in
Table 5). The corresponding summary statistics are reported in
Table 7. The two front-runners are CatBoost-recursive (MAE 22.93 €/MWh, RMSE 31.04,
0.889) and CNN–LSTM (22.91, 31.15, 0.894); their mean-MAE gap is negligible (0.02 €/MWh) and, as the significance tests below confirm, not statistically distinguishable. Both clearly lead the remaining candidates: LSTM and GRU follow (23.3–23.4 €/MWh), then CNN (25.2), while Random Forest (27.3) and LEAR (27.2) fall just behind the seasonal-naïve baseline (26.1) at this week-ahead horizon. Only the five strongest learners attain
(i.e., beat the in-sample seasonal naïve); LEAR’s degradation is consistent with the difficulty a purely linear autoregressive model faces in extrapolating 168 h ahead, in contrast to its strong day-ahead performance reported by Lago et al. [
3]. Training cost is comparable across the neural models and CatBoost (21–33 s per monthly recalibration), with Random Forest the clear outlier (113 s, and ∼14 s per forecast against <0.4 s for the others). We carry the two front-runners—together with a direct multi-horizon CatBoost variant—into a focused, significance-tested comparison over the full 2024 year (
Section 7.2). The endogenous (NW) configuration used as the AOI reference baseline in
Section 7.6 settles at a closely comparable 23.2 €/MWh.
The two leading learners reduce mean MAE by about 12% relative to the seasonal-naïve baseline (26.1 €/MWh) and reach
. The margin over the naïve baseline is smaller than is sometimes seen at the day-ahead horizon, reflecting the strength of weekly seasonality as a week-ahead predictor: the seasonal naïve is competitive at the median but has a heavier right tail on volatile weeks, which the learners smooth. Notably, LEAR—a very strong day-ahead benchmark [
3]—does not transfer to this 168-hour-ahead setting, finishing below even the naïve baselines (
); a purely linear autoregression struggles to project the full weekly trajectory, which motivates the non-linear models.
CatBoost-recursive and CNN–LSTM are separated by only 0.02 €/MWh in mean MAE, with CatBoost marginally ahead on RMSE and MASE and CNN–LSTM marginally ahead on MAE; their weekly-MAE distributions overlap almost entirely (
Figure 5). The choice between them therefore cannot be made on the screen alone and is resolved by the significance-tested comparison of the next subsection.
7.2. Focused Comparison and Significance Testing
To put the screening result on a firmer footing, the full benchmark was re-evaluated on weekly rolling origins spanning the whole of 2024. To leave no ambiguity about the design: the evaluation period is the 2024 out-of-sample year (with 2025 held out entirely); each origin issues a 168-h recursive forecast; the start day of the week is rotated across origins so the result does not depend on a fixed weekday; and every origin is trained on an expanding window of strictly preceding data that begins in 2023 and ends just before it. The window is anchored at a fixed 2023 start and grown to each origin rather than rolled forward at fixed length; because all models share the same window at each origin, the differences reported below reflect the models, not their training data. Pairwise accuracy is assessed with the Diebold–Mariano (DM) test [
64], using the Harvey–Leybourne–Newbold small-sample correction [
65] and a Newey–West long-run variance, applied to the per-origin MAE differential.
Table 8 reports the test of the selected model, CatBoost-recursive, against every other candidate on the endogenous (no-weather) configuration, which is the cleanest like-for-like comparison because all learners then share an identical feature set.
Each reported p-value is the probability of observing a per-origin MAE differential at least as large as the one measured if the two models were in fact equally accurate; a value below the conventional threshold therefore signals a statistically significant difference, while a larger value means the observed gap is within week-to-week sampling noise. On endogenous features, CatBoost-recursive significantly outperforms the LEAR benchmark, the day-of-week persistence baseline, and Random Forest (, , ). Its advantage over the seasonal-naïve baseline and the plain CNN, although sizeable in mean MAE (3.2 and 2.3 €/MWh), is not statistically significant at the per-origin level ( and ): with only a single year of weekly origins, the week-to-week variance of MAE is large, which limits the power of the test at this week-ahead horizon and is consistent with the heavy right tail of the seasonal naïve on volatile weeks noted above. CatBoost-recursive is statistically indistinguishable from the three recurrent architectures LSTM, GRU, and CNN–LSTM (, , ). Of all eight competitors the hybrid CNN–LSTM is the closest match: its mean-MAE differential is essentially zero ( €/MWh) and its p-value of is the highest in the table, so it is statistically the least distinguishable from CatBoost-recursive. No model significantly beats CatBoost-recursive, and CNN–LSTM matches but does not exceed it. Because CNN–LSTM is the only model that genuinely rivals the selected one, it is the natural focus of the deeper, scenario-by-scenario comparison that follows.
This leaves two genuine contenders, which we examine head-to-head across all three weather scenarios: the hybrid CNN–LSTM (the joint front-runner on the screen) and a direct multi-horizon CatBoost (which predicts each day’s 24 prices jointly with a multi-output model, day-block by day-block, rather than rolling a one-step model forward).
Table 9 reports the pairwise tests.
Two clear conclusions emerge. First, the recursive roll-out is the right construction: CatBoost-recursive beats the direct multi-horizon variant by a wide and significant margin in every scenario (no-weather
, TMY
, forecasted-weather
€/MWh;
throughout). Second, CatBoost-recursive and CNN–LSTM are statistically tied on endogenous and climatological inputs (no-weather
,
Table 8; TMY
) but the tie breaks once an operational weather forecast is supplied, where CatBoost-recursive becomes significantly more accurate (forecasted weather,
€/MWh,
): the gradient-boosting model extracts more value from the weather signal than the hybrid network does.
CatBoost-recursive has the lowest error at all seven lead days—including day 1, where no recursion error has yet accumulated (13.3 versus 16.9 €/MWh for the direct variant and 18.1 for CNN–LSTM)—and its margin over the direct construction broadens as the horizon lengthens. CNN–LSTM tracks CatBoost-recursive closely over the first few days but deteriorates faster at the weekly tail.
Figure 6 reports the corresponding lead-day MAE profile under the operational forecasted-weather scenario.
This pattern is visible at the level of an individual week.
Figure 7 overlays the three contenders against the realised price for a representative origin (10 July 2024) under the forecasted-weather scenario: CatBoost-recursive and CNN–LSTM both reproduce the daily peak/trough structure and the weekly envelope, whereas the direct multi-horizon CatBoost flattens the extremes—it underestimates the evening peaks and overestimates the overnight troughs—which is precisely the behaviour that accumulates into its larger lead-day and aggregate errors.
Adding forecasted weather lowers CatBoost-recursive to 19.53 €/MWh, and it remains the best model in every feature scenario: against the direct multi-horizon variant the gap is
€/MWh and against CNN–LSTM
€/MWh under forecasted weather (
Table 9).
This ranking is confirmed on the fully out-of-sample 2025 year (used for nothing during development): with forecasted weather, CatBoost-recursive attains MAE 21.39 €/MWh (
) whereas CNN–LSTM rises to 26.11 €/MWh, a gap that remains significant (DM
). The tree-based recursive model thus generalises to the held-out year more reliably than the hybrid network. Training cost is comparable to the neural models (
Table 7), so the selection rests not on speed but on accuracy once weather is included, robustness to the held-out year, and a simpler, more stable training procedure—a single gradient-boosting model rather than a neural architecture requiring per-sample normalisation and early-stopping tuning. CatBoost-recursive is therefore selected for all subsequent analyses.
7.3. Forecast Error Evolution and Regime-Stratified Performance
To place the 2024 benchmark within a wider historical context, the same fixed CatBoost configuration was applied retrospectively to each year from 2019 to 2024. For each target year
X, the model was trained only on data from the beginning of year
up to the forecast origin. This keeps the training-window length broadly comparable across years, so that differences in
Table 10 mainly reflect changing market conditions rather than a mechanically expanding training sample. This pass is illustrative context for how forecast difficulty co-moved with the crisis and is distinct from the rigorous model comparison of
Section 7.2. The resulting monthly and annual average MAEs are displayed in
Figure 8.
The picture that emerges is one of pronounced regime dependence. Annual MAEs of 6–7 €/MWh in 2019–2020 rose sharply to 22 and 32 €/MWh in 2021 and 2022 respectively, before settling at around 23 €/MWh by the end of 2024 as the market normalised. The corresponding regime-level statistics are summarised in
Table 10. During the crisis period from mid-2021 to end-2022, both the price level and the realised volatility rose by approximately an order of magnitude, and the CatBoost week-ahead MAE moved from roughly 7 to about 26 €/MWh. The relationship is consistent with a component of forecast difficulty that scales with market volatility (R
2 = 0.30 between monthly price-level volatility and monthly MAE in 2024), and suggests that part of the error observed during this period reflects inherent price unpredictability rather than model inadequacy alone. The subsequent post-crisis normalisation in 2023–2024 brought forecast errors back to a level close to, though still somewhat above, the pre-crisis baseline. Several factors could plausibly contribute to this residual gap—including more frequent negative-price episodes, changing gas-price dynamics, higher renewable penetration, and evolving bidding behaviour—but the present feature set does not include cross-border flow variables and therefore cannot isolate the role of interconnection; we accordingly treat these as candidate explanations rather than established effects. Interconnection in particular cannot be exploited at this horizon in any case: realised cross-border flows are published only after the day-ahead auction, and the forecasted transfer capacity available beforehand is only weakly correlated with price (
Section 9).
7.4. Training Period Sensitivity
Table 11 shows that, among the three single-year training windows tested, the model trained on 2023 data yields the best 2024 performance. Training on 2022 crisis data instead degrades MAE by 12.85%, while training on 2021 data adds 7.11%. Within this single-year comparison, the immediately preceding year is therefore the most informative starting point, which motivates anchoring the deployed expanding window at 2023 rather than reaching back into the crisis years. Multi-year rolling strategies with alternative start years were not exhaustively explored and could in principle yield different results.
The configurations exercised in the analyses that follow are exactly those mapped in
Table 5. The common operational benchmark and the weather-scenario experiments rely exclusively on features available at the time of forecast issuance, so that they correspond to genuinely deployable settings; the full-feature configuration used for the importance analysis additionally incorporates historical weather (HW) and realised energy-system variables, and is therefore best understood as an ex-post explanatory upper bound rather than an operational forecast.
7.5. Categorical Feature Importance
The leave-one-out experiment presented in this subsection differs in scope from the weather-scenario comparison reported in
Section 7.7, and the distinction is important to bear in mind when interpreting the results. The baseline of the present experiment is the full feature set (time, weather, and energy variables), and each feature category is then removed in turn from this baseline. As a consequence, the “No Weather” configuration shown in
Figure 9, which yields an MAE of approximately 11 €/MWh, retains the energy features and is therefore not directly comparable with the no-weather row in the weather-scenario analysis reported later, where both weather and energy features are absent and the MAE rises to about 23 €/MWh. For this reason, the analysis that follows should be read as an ex-post explanatory upper bound rather than as a fully operational week-ahead forecast, since the energy features incorporate realised system conditions that would not be available to a forecaster at the time of issuance.
With this caveat in mind, the experiment yields a clear ranking. Removing the energy features alone causes the MAE to roughly double, from 9.52 to 20.4 €/MWh, an effect substantially larger than that observed when either the time or the weather features are removed. This finding provides empirical support for the theoretical argument developed in
Section 2, in which the instantaneous generation mix, and in particular the level of natural-gas-fired generation, was identified as a direct observable proxy for the position of the market-clearing price on the merit-order stack. The doubling of MAE upon removal of the energy block is consistent with this interpretation: when the model loses sight of the dispatch state, it can no longer locate the clearing price along the supply curve, and forecast accuracy degrades accordingly.
7.6. Feature Importance: AOI and LOO
This analysis is deliberately exploratory: rather than asking what causes the price, it asks which contemporaneous system variables, if their realised values were known, would most reduce week-ahead error—thereby revealing where forecast skill is gained or lost and which fundamentals are worth forecasting explicitly. Because these variables are strongly correlated with one another (gas-fired generation, for instance, moves together with demand, renewable output, imports, and fuel prices), no single number captures a feature group’s “importance”; we therefore probe each group in two complementary ways—once on its own and once in the presence of all the others—and read the two together.
We use two complementary measures of predictive importance. Add-one-in (AOI) importance is the accuracy gain from adding a single feature group
j to the endogenous baseline (price lags and calendar), i.e., how much that group helps on its own; leave-one-out (LOO) importance is the accuracy loss from removing group
j from the full-information model, i.e., its marginal contribution given everything else. The two need not agree: under correlated predictors a group can be informative in isolation (high AOI) yet redundant at the margin (low LOO), or vice versa. We emphasise that “LOO” here denotes leave-one-feature-out importance and is unrelated to leave-one-out cross-validation. Formally,
The two reference points bound the reducible error: the operational endogenous baseline reaches 23.2 €/MWh, whereas a model with the full set of realised system variables (an ex-post upper bound, not an operational configuration) reaches 9.5 €/MWh. The difference,
€/MWh, is therefore the error that perfect knowledge of contemporaneous system state would close, of which natural-gas generation is the single largest contributor.
It is important to interpret these quantities correctly. They measure predictive informativeness, not causation: gas-fired generation is highly informative because it proxies the position of the marginal unit in the merit order, but it is itself correlated with demand, renewable output, imports, and fuel prices, so the analysis does not isolate a causal effect of gas generation on price. We therefore present gas generation as the dominant predictive and explanatory feature, consistent with the marginal-pricing mechanism, while refraining from causal attribution. The AOI/LOO ranking is likewise an ordering of informativeness rather than a precise, confidence-bounded ranking; quantifying its robustness (e.g., by bootstrap or across sub-periods) is left to future work.
Negative AOI importance (Water Reservoir: ; Total Load: ) indicates that these features marginally worsen accuracy when used in isolation. Their signal is already encoded in the lagged price history; they add noise when used alone but contribute marginally within the full context (positive LOO importance).
Table 12 and
Figure 10 present the full results. Natural gas and pumped-hydro consumption are the dominant features, directly consistent with the merit-order argument: both reflect the instantaneous balance between supply and demand at the margin. Wind Onshore ranks third, as large wind surpluses push gas turbines off the margin, suppressing or inverting the clearing price [
13].
The top four features combined (Natural Gas, Hydro Cons., Wind Onshore, Wind Speed) achieve MAE ≈ 10.6, only ∼1.1 €/MWh above the full model’s 9.52.
7.7. Weather Input Scenarios
The experiment reported in this subsection isolates the contribution of weather information to forecast accuracy, and for this reason the model is trained on time, lagged-price, and weather features only, with no energy variables included. This design choice is what distinguishes the present analysis from the categorical leave-one-out experiment of
Section 7.5: the NW row in
Table 13, with an MAE of 23.7 €/MWh, corresponds to a configuration in which neither weather nor energy features are available, whereas the “No Weather” bar in
Figure 9, with an MAE of approximately 11 €/MWh, retains the energy block and therefore reflects a much narrower deprivation of information.
This table represents averages on a 168-h forecasted window rolling every day of 2024 (365 windows) in a way to give the most realistic averages. Three observations now follow. First, the operational forecast (FW) is the best weather input: it sits only 0.71 €/MWh above the perfect-foresight oracle (HW) and recovers about 84% of the oracle’s improvement over the no-weather baseline, so the day-ahead numerical weather prediction (NWP) product is skilful enough to capture most of the realisable weather value. Second, TMY climatology is essentially tied with the no-weather baseline (23.48 vs. 23.73 €/MWh): a generic seasonal climatology adds little once price lags are present, because it carries no information about the specific weather of the forecast week. Third, the advantage of real weather information is strongly horizon-dependent, as shown by the per-lead-day decomposition in
Table 14: at Day 1 all scenarios are within 0.3 €/MWh (recent price lags dominate and the weather signal is redundant), whereas by Day 7 the forecast advantage over no-weather grows to about 4.4 €/MWh and the operational forecast tracks the oracle closely throughout. This horizon profile is exactly what one expects—weather matters where the autoregressive signal has decayed—and it explains why the value of weather data is easy to miss in horizon-pooled metrics.
These results invert the earlier interpretation: operational weather forecasts are not a liability but the recommended weather input for week-ahead EPF in MIBEL, and their benefit is concentrated at the multi-day horizons that motivate week-ahead forecasting in the first place. Consistent with this, recent evidence shows weather predictions improving electricity-price forecasts at longer horizons [
66], and renewable-generation forecast errors propagating into imbalance volumes and spot prices [
67,
68].
7.8. Optimal Lag Selection and Horizon Performance
The optimal lag window is investigated through a sweep over lag lengths ranging from 48 to 384 h, performed separately for each forecast day from Day 1 to Day 7. The MAE as a function of lag length is shown in
Figure 11, and the per-horizon optima are reported in
Table 15.
A clear pattern emerges from
Table 15: the optimal lag window grows with the forecast horizon, increasing from 96 h for Day 1 to 384 h for Day 7. This behaviour is consistent with the autocorrelation analysis presented earlier, in which the autocorrelation function of the price series exhibits a strong peak at 168 h and retains substantial persistence up to 336 h. The predictive content of these long lags is therefore most valuable for multi-day-ahead steps, where short-term autocorrelation alone is no longer sufficient. For operational simplicity, a single lag window of 336 h is adopted across all forecast horizons. The cost of this uniform choice is modest: even in the worst case (Day 6 and Day 7, which would individually prefer 384 h), the MAE penalty relative to the per-horizon optimum does not exceed 0.7 €/MWh.
After re-tuning the model hyperparameters at the chosen 336-h lag window, the final error metrics are obtained as follows: the full-feature configuration (FF) yields an MAE of 9.74 €/MWh and an RMSE of 12.62 €/MWh; the operational forecasted-weather configuration (FW) yields 19.53 and 26.32 €/MWh respectively; and the no-weather baseline (NW) yields 22.93 and 31.04 €/MWh. The corresponding error profiles are displayed in
Figure 12.
7.9. Monthly Error Trends (2024)
Figure 13 and
Figure 14 resolve the scenarios month by month. The no-weather model (NW) is most error-prone in the volatile months, peaking in February and September (≈36 €/MWh) and breaching the in-sample seasonal-naïve benchmark there (MASE > 1); supplying an operational weather forecast (FW) lowers the error in almost every month and holds the MASE below 1 in all months but November. The ex-post full-feature scenario (FF), shown for reference in the heatmap, stays at 8–11 €/MWh in every month, so most of the residual monthly error in the deployable FW scenario reflects forecast uncertainty rather than irreducible noise. Both deployable scenarios track the price level—the scaled error is smallest in the low-priced spring months and largest in the high-priced, weather-driven winter—consistent with the marginal-cost pricing framework.
8. Battery Arbitrage Model and Results
A price-taking battery energy storage system is modelled [
69,
70,
71,
72] with power limit
, energy capacity
(a 4-h asset), and symmetric round-trip efficiency
. Charging and discharging efficiencies are therefore set as
The model uses an hourly time step throughout, so power and energy are linked directly over each optimisation interval. For each rolling optimisation window, three decision variables are defined for every hour
of the horizon: charging power
(MW;
buy), discharging power
(MW;
sell), and state of charge
(MWh). Dispatch is determined by the following linear programme:
subject to
Under this formulation, simultaneous charging and discharging is economically dominated because
; accordingly, such behaviour does not arise in the optimal LP solutions considered here.
A natural question concerns the role of a terminal state-of-charge condition,
which would force the battery to end each optimisation window at its initial charge. We do not impose Equation (
10) in the reported results; instead we leave the terminal state free, so that the only difference between the two horizons below is the length of the look-ahead.
The dispatch schedule
is computed using the forecast price
over the optimisation horizon. For the perfect-foresight (PF) benchmark,
, so realised prices replace forecasts and provide an upper-bound reference. In all other cases, the battery charges in hours forecast to be relatively cheap and discharges in hours forecast to be relatively expensive. After the optimisation is solved, only the first 24 h of the schedule are executed, and realised profit is settled against the observed market price
:
Hence, the forecast determines the timing and magnitude of scheduled trades, whereas realised prices determine their monetary outcome. Forecast error therefore enters performance through mis-timed and mis-sized trades rather than through the settlement rule itself.
Both strategies are run as a receding-horizon controller that commits only the first 24 h and rolls forward one day at a time, carrying the realised end-of-day state of charge
as the next initial condition
. They differ solely in how far they look ahead when optimising: the 168 h strategy solves over the full 7-day forecast window (
) before committing 24 h, whereas the 24 h strategy sees only the day-ahead 24-h slice (
). The 24 h strategy therefore has no information beyond the current day and, lacking any reason to hold energy overnight, empties the battery at the end of every day; the 168 h strategy can instead retain energy across day boundaries when a more profitable opportunity is forecast later in the week. This isolates the value of the look-ahead, not of any terminal constraint. Annual profit is accumulated only over the 24-h execution layer, avoiding double counting across overlapping windows. Forecast value is then summarised using the value-capture ratio (VCR) and economic regret:
where
denotes total annual realised profit. A VCR of unity indicates perfect value capture relative to PF, while economic regret measures the absolute opportunity cost associated with imperfect forecasts.
Before turning to the aggregate performance figures, it is instructive to examine the dispatch behaviour induced by each forecast.
Figure 15 shows the fraction of trading days on which each hour-of-day contains active charging or discharging under the 168 h strategy. Across all models, discharging exhibits a clear bimodal structure, with a morning peak around 08:00–10:00 and an evening peak around 20:00–23:00, consistent with the main daily demand ramps. Charging is concentrated primarily in the overnight off-peak period (03:00–06:00), with a secondary cluster during the midday to afternoon trough (approximately 14:00–16:00), when prices are often depressed by solar generation. PF displays the sharpest and most concentrated charge–discharge pattern, reflecting the strongest temporal discrimination in the underlying price signal. TMY, by contrast, shows the broadest charging window and a smoother dispatch profile, consistent with a coarser forecast that provides less precise temporal guidance. FW lies between these extremes, most closely reproducing the PF dispatch structure.
The reference asset is parameterised on ENGIE’s Tarifa standalone battery in Andalusia—200 MW/800 MWh (a 4-h duration), the largest standalone BESS currently under development in Spain (its sister project Álora is 78 MW/312 MWh, also 4 h) [
73]. The backtest is run on the fully out-of-sample 2025 year, providing a genuine forward test of forecast-driven dispatch. The dispatch model deliberately abstracts from several real-world costs in order to isolate the contribution of forecast quality. Battery degradation, cycling costs, variable O&M, transaction and imbalance charges, and market-impact effects are not modelled, and the price-taker assumption is maintained throughout. These simplifications mean that the reported profit figures represent an upper bound on achievable economic value under the tested forecasting configurations, rather than financial projections for a specific asset. Finally, because the price-taker LP is positively homogeneous of degree one in the rating, both profit (linearly) and the VCR (exactly) are determined by the energy-to-power ratio alone, so the value-capture ratios reported below are independent of the MW rating and transfer unchanged to any 4-h asset, including the smaller operational 3 MW/9 MWh Campo Arañuelo III unit in Cáceres [
74].
Table 16 reports the arbitrage performance of the PF, FW, and TMY price inputs on the 2025 out-of-sample year. The dominant message is that the operational forecast captures most of the attainable value already at the 24 h horizon: under forecasted weather the VCR reaches 87% at 24 h and rises to 89% at 168 h, against a perfect-foresight ceiling of about 20.1 M€/yr for this 200 MW asset. The FW and TMY inputs yield very similar economic value (within one percentage point of VCR), even though FW has a substantially lower price MAE (
Section 7.7). This is expected: arbitrage value depends on correctly ranking cheap and expensive hours rather than on the precise price level, so a coarser weather input can still drive near-optimal dispatch. The dispatch timing underlying these figures is shown in
Figure 15: all three inputs charge predominantly in the overnight and midday-solar troughs and discharge into the morning and evening peaks, with PF producing the sharpest pattern, TMY the broadest, and FW closely tracking PF.
At this 4-h duration the benefit of extending the optimisation horizon from 24 h to 168 h is real but modest: the forecasted-weather gain is
(TMY
), and even under perfect foresight the headroom is only
. The 24 h-to-168 h gain can in principle arise from three distinct effects—terminal-state distortions, the optimisation horizon, and the forecast horizon—which the present design separates cleanly. Terminal-state effects are immaterial: enforcing the cyclic condition (
10) reproduces the free-terminal profits to within rounding (<40 € on annual profits of order
€), so end-of-horizon distortions explain essentially none of the gain. The remainder is an optimisation-horizon effect—a longer window lets the controller shift energy across day boundaries—whose magnitude is bounded by the perfect-foresight column: with prices known exactly, extending the horizon is worth only
, because a 4-h asset fills and empties within a day and little inter-day spread remains to exploit. The forecast horizon then governs how much of this ceiling is realised: forecast error beyond the first day erodes the
perfect-foresight headroom to
under an operational weather forecast (
under climatology). The gain is therefore a genuine cross-day optimisation-horizon benefit rather than a terminal-state artefact; its ceiling is small for a 4-h asset; and forecast quality sets the fraction of that ceiling captured. The same decomposition implies that the effect would grow for longer-duration storage, where genuine multi-day arbitrage—and hence the optimisation-horizon component—becomes materially larger.
11. Conclusions
This paper has presented a comprehensive applied benchmark study of week-ahead hourly electricity price forecasting for the Spanish day-ahead market. The investigation combines a statistical characterisation of the 2020–2024 price series, a multi-model benchmarking experiment conducted under a unified evaluation protocol, an economically grounded feature-importance analysis, and a rolling battery-arbitrage evaluation under both 24-h and 168-h optimisation horizons. Taken together, these strands of analysis support three principal findings, which are summarised below.
- 1.
The first set of findings concerns predictive accuracy and its statistical significance. Under a common endogenous benchmark—lagged prices and calendar variables only, evaluated on weekly rolling origins spanning the whole of 2024 with an expanding training window anchored at 2023—a recursive CatBoost and the hybrid CNN–LSTM are statistically indistinguishable by the Diebold–Mariano test () and lead a nine-model field in which both also significantly outperform a direct multi-horizon CatBoost, while a LEAR benchmark that is strong at the day-ahead horizon does not transfer to the week-ahead setting. The recursive roll-out is more accurate than the direct construction at every lead-day, including Day 1, answering the question of whether per-day direct prediction would be preferable. Once an operational (forecasted) weather input is added, recursive CatBoost becomes significantly the most accurate model ( versus CNN–LSTM), a ranking confirmed on a completely held-out 2025 year (, where CNN–LSTM rises to MAE 26 €/MWh against 21 €/MWh for CatBoost-recursive). Formal significance testing is therefore part of this study rather than an outstanding limitation.
- 2.
The second set of findings concerns operational fitness — consistency, computational cost, and robustness across regimes. Recursive CatBoost is the preferred operational model: it is statistically tied with the best neural model on endogenous features, becomes the most accurate once weather is included, and is the most robust to the held-out year, while training in time comparable to the deep-learning models (about 30 s per monthly recalibration, against ∼113 s for Random Forest) and relying on a single gradient-boosting model rather than a neural architecture that requires per-sample normalisation and early-stopping tuning. Its performance is stable across the COVID-19 demand shock, the 2021–2022 gas-price crisis, and the subsequent normalisation. A uniform 336-h lag window is a near-optimal compromise across forecast Days 1–7. On weather inputs, the corrected analysis shows that operational weather forecasts are the best weather input, recovering about 84% of the perfect-foresight weather improvement over the no-weather baseline and sitting only 0.71 €/MWh above the oracle, whereas TMY climatology is essentially tied with using no weather at all. The recommended deployable configuration therefore uses forecasted weather, and its advantage is concentrated at the multi-day horizons that motivate week-ahead forecasting.
- 3.
The third set of findings concerns the economic interpretation of the feature-importance ranking obtained from the AOI/LOO analysis. Across the candidate exogenous variables tested, natural-gas-fired generation emerged as the single most informative predictor, with an add-one-in importance of 10.55 €/MWh, well above any other individual feature. This ranking is fully consistent with the merit-order pricing argument developed in
Section 2, in which natural gas generation acts as a direct observable proxy for the position of the market-clearing price along the supply stack. It is important, however, to be precise about the interpretive scope of this result: the AOI/LOO analysis should be read as a characterisation of residual forecast difficulty rather than as a recipe for an operational forecasting feature set. In other words, the dominance of the gas-generation feature reflects the fact that gas dispatch is the most predictively informative state variable for the residual error—it most sharply locates the clearing price on the merit-order stack—not a claim that gas-generation uncertainty is the sole or causal driver of forecast error (it co-varies with demand, renewables, imports, and fuel prices), nor the suggestion that future gas generation values can be exploited directly by an operational model, since these values are not known at the time of issuance. The same interpretation also explains, in a fully consistent way, the doubling of MAE that is observed when the entire energy-feature block is removed in the ex-post explanatory experiment of
Section 7.5: once the contemporaneous dispatch state is hidden from the model, the forecaster loses the most direct signal about where on the merit-order curve the clearing price is being formed.
- 4.
The final set of findings translates forecast quality into economic value through the battery-arbitrage backtest. For a 4-h grid-scale unit (200 MW/800 MWh, parameterised on ENGIE’s Tarifa project) on the out-of-sample 2025 year, a forecast-driven dispatch captures the large majority of the perfect-foresight value already at the day-ahead horizon (value-capture ratio ≈ 87% at 24 h, rising to ≈89% at 168 h), and the economic gap between the operational forecast and a coarse TMY climatology is small—because arbitrage value depends on correctly ranking cheap and expensive hours rather than on the price level. Extending the optimisation horizon from 24 h to 168 h yields only a modest additional gain for this 4-h asset (≈2.4% under forecasted weather), which we attribute to the optimisation horizon (cross-day look-ahead) rather than to terminal-state effects: the perfect-foresight ceiling is only , and imposing or relaxing the terminal state-of-charge condition leaves the result unchanged (as does the MW rating). This locates the principal economic value of week-ahead forecasting in longer-duration storage and in multi-market applications beyond single-market day-ahead arbitrage.
Cross-border interconnection deserves specific comment, because earlier work (Romero et al. [
38]) found French interconnection prices useful and a natural question is why interconnection variables are absent here. The distinction is one of horizon and of what is observable when a forecast is issued. The quantity that carries genuine cross-border information—the realised commercial exchange (scheduled flow)—is published only about one hour after the last day-ahead allocation, so it is an ex-post quantity unavailable at week-ahead issuance, exactly like the realised generation used in our explanatory AOI/LOO analysis. The one interconnection quantity that is known before the auction, the forecasted day-ahead net transfer capacity, is an administratively-set, slowly-varying series only weakly correlated with the Spanish hourly clearing price over 2024 (
across the four ES–FR and ES–PT borders, and
for net offered export capacity). Adding these forecasted cross-border capacities to the operational CatBoost feature set confirms this directly: rather than helping, they degrade accuracy, raising the 2024 MAE from
to
€/MWh (
) and the RMSE from
to
€/MWh, so the only interconnection signal available before the auction carries no usable week-ahead information. Romero et al.’s finding is not contradicted: their French interconnection prices are a day-ahead-available cross-border price spread that helps at the day-ahead horizon, whereas at the week-ahead horizon neither the realised flow (ex-post) nor a seven-day capacity forecast is comparably informative. Bringing interconnection into a week-ahead model therefore calls for a forecasted cross-border price spread rather than a realised flow, which we leave to future work alongside the incorporation of gas-commodity price forecasts.
Two caveats bound the present results. First, because training uses an expanding window anchored in 2023, the earliest 2024 origins are trained partly on the capped-price regime of 2023 (the Iberian gas cap expired on 31 December 2023); the monthly recalibration adapts to the uncapped 2024 regime within a few months, but a mild level shift at the train–evaluation boundary remains. Second, the AOI/LOO ranking is an ordering of predictive informativeness, not a causal attribution or a confidence-bounded ranking. Further work could place bootstrap intervals on the feature ranking, explore multi-market coupling with Portugal and France, and test whether the merit-order proxy relationship documented here persists as Spain’s renewable penetration approaches its 2030 targets.