It’s more complicated than that…..
Gas provides around half of our electricity overall, so of course the price of gas affects the price of electricity. But because of the way the market is set up, it has more of an effect than it should.
Imagine you are buying apples rather than electricity, and you want 100 of them. Lots of farmers are offering apples at 10p, some at 15p….. but the total available at those prices only adds up to 50 apples. And down the road there is Gas Powered Apple Farmers Ltd, who will sell you apples at 20p. So you buy 50 apples from them - but you pay all of the farmers 20p, even the ones who would have sold them for 10p or 15p.
Now imagine the wind and solar-powered farmers are having a bumper year, and they can supply 95 apples. You still need the other 5, so you have to buy them from Gas Powered Apple Farmers Ltd. Only gas prices have rocketed, so now they are selling for 50p, and you have to have them, so you pay 50p for all the apples.
As long as you need to buy one single apple from Gas Powered Apple Farmers, you pay top price for them. But on the odd occasion when the solar and wind powered farms can produce enough (like in the middle of the night, when fewer people want to buy apples), the price will suddenly drop to 15p.
It’s a barmy system, which is why there is work going on about changing it. It explains why overnight electricity is cheaper (lower demand)
By the way, a lot of the solar and wind generators are on something called a Contract for Difference. They have agreed a price for their output, which is fixed for a fair number of years. When the market price is higher than their contracted price, they pay the extra back to the QUANGO which runs the scheme. When the market price is lower, they get a refund from the scheme. This scheme is funded by a levy on energy retailers, and until recently formed part of the standing charge. As of the October price cap, that part of the levy is now zero, and there are changes afoot to allow it to be negative.
In other words, the extra profit which solar and wind generators are making (because they could cover their costs and make a reasonable profit selling their apples for 10p or 15p, but the system forces them to receive 50p for them) will eventually find its way back to customers in reduced bills.