BENGALURU, July 16 (Reuters) - Indian shares retreated from record highs on Friday as investors locked in gains in technology stocks, offsetting a rise in metal and pharmaceutical shares.

By 0439 GMT, the NSE Nifty 50 index was up 0.04% at 15,931.20 and the S&P BSE Sensex rose 0.02% to 53,171.13. For the week so far, both the indexes are up more than 1% and on track to log their first weekly gain in three.

"We expect all dips to be bought into amid range-bound movement... but, with so many large IPOs coming in, liquidity may be moved there and investors are very cautious at these levels," said Samrat Dasgupta, CEO of Esquire Capital Investment Advisors in Mumbai.

Several Indian startups have spelt out plans to go public to cash in on liquidity by foreign funds.

Digital payments startup Paytm filed for an initial public offering of up to 166 billion rupees ($2.23 billion), its draft papers submitted to the country's market regulator showed.

The Nifty IT index, which is up 3.68% this week till Thursday's close, fell 0.86% on Friday.

"Top IT companies have really good fundamentals and we are very bullish on this sector. On days like these, dips in these stocks should be bought into," Dasgupta said.

The Nifty Metal index was up 0.62%, lifted by gains in steel makers Tata Steel and JSW Steel , a day after world's biggest producer China recorded a dip in crude steel output.

The Nifty Pharma index, which had closed 0.27% lower on Thursday, hit an all-time high.

Shares of Angel Broking jumped 11% to an all-time high after the stockbroker's June-quarter consolidated profit more than doubled.

Trading sentiment was dampened by Asian shares which were headed lower on profit-taking in Taiwanese chip giant TSMC and weighed on other tech firms and broader risk sentiment. ($1 = 74.5140 Indian rupees) (Reporting by Shivani Singh in Bengaluru; editing by Uttaresh.V)