A coherent radiation mechanism for type IV solar radio bursts