In this paper we propose a quantile regression based test to detect long memory that generalizes the Lagrange Multiplier test by Breitung and Hassler (2002, Journal of Econometrics). The procedure is robust with respect to outliers or leptokurtic distributions. Moreover, it allows to detect whether the degree of memory or fractional integration varies at different quantiles, which is particularly useful when one is interested in the tail-behaviour of the data. The limiting distribution is Gaussian or χ2 and free of nuisance parameters. The validity in finite samples is established through Monte Carlo experiments. The application to daily realized volatility produces new insights into the widely accepted long-memory feature: The model with a constant order of integration is rejected due to persistence that is growing with increasing quantiles. This evidence suggest the existence of different regimes with different degree of persistence in realized volatility.