kerregan Sorry I wasn't very clear what I meant. Your example isn't what I am trying to do.
What I wanted to say was that if I charge the battery in a 20p slot I will hold it there and use the grid for the next 'n' slots until they rise above 24p. Effectively I count the stored charge in the battery as costing 24p taking into account the losses even though it actually cost me 20p. I am looking ahead at what's coming up so know that I might be storing this unit until the most expensive slots in the day.
If the slot prices are going down rather than up I wouldn't be charging in the 20p slot but in the later cheaper ones.
My goal isn't to charge the battery to full but to cover the most expensive slots in the day (allowing for the 20% losses) from the cheapest slots in the day. If the whole day had slots within that 20% band I wouldn't want to use the battery at all.
My analogy might be that if the slots cost 20p, 23p, 23p, 30p and I used 1 unit for the house in each slot I would add one unit to the battery in the 20p slot, hold it there in the 2x23p slots and then use it in the 30p slot. This would cost 2x20p + 23p + 23p = 86p. If I used the stored charge in the next immediate slot after charge (i.e. without holding it) this would cost 2x20p + 23p + 30p = 93p. Both would have losses of 4p for the unit that was briefly stored. But if all the future slots were 23p then I would hold that unit in the battery indefinitely (until the next day when I know what they next set of prices are). At that point it will become a sunk cost.