Market reverses after gaining for 3 straight days

But losses were capped on foreign capital inflows and gains of some large-cap stocks.