If I had the money, I would buy a new car.
The above is fine; it is a conditional sentence. This maybe an event took place yesterday or 10 or 15 years ago.
---------------------------------------------------------------------------
If I had had the money, I would have bought a new car.
Is this correct?
If this is correct, what would be the context for it? It can't be yesterday or 10 years ago.