Why can moving averages of the prices indicate the trend of a stock? In technical analysis of stock trading, we can use the moving averages of the historical prices of a stock to indicate whether it is currently in the uptrend or downtrend. 
Let me exemplify the idea to focus my question. I may use a 10-day moving average,  MA10, and a 30-day moving average, MA30. If, at the present time, MA10 equals MA30 and the rate of change of MA10 is positive, then I can believe that the price is in uptrend, or in downtrend if negative.
The question is, I would like to know the mathematical principle behind this trick. Why using the averages as such can improve the possibility of the price being in uptrend or downtrend?
 A: This is not true.
If the price follows a Brownian motion, then there is no such thing as a trend and yet your tools predict a trend sometimes.
A: We usually use Brownian motion (BM) + drift, so the question is meaningful.
The main issue for market prices is that the drift is much lower than the variability, and evolves rapidly in time, hence it is hard to measure.  Basically, for most statistical models, sliding average is used to smooth the signal, so that the variability is reduced and the trend becomes more evident.
In any case, the empirical trend is a random variable and can be non zero even if the real trend is zero. Significancy tests exist but depend on a more or less arbitrary model we are using.
For the mathematical aspect, I underline that moving average (or exponantially moving, for what matters) is not fitted to Brownian Motion (the proper estimator would be the average of the returns, not the average of the price itself which is integrated).
However, Brownian Motion is only a model, and technical analysis is not necessary consistent with this model ! When you take (moving) averages, you assume somehow a stationnarity of order 1, i.e stability in time of the amplitude of what you average. It isn't the case for a B.M, but a stationnary time serie makes sense in the short term to model prices.
We are not aware of any perfect model to fit stocks prices, so the debate is open. A possible way to chose between a BM and a stationnary serie would be to statistically backtest it : for each date in your historical sample, take the past of that date, compute your average (and any competing procedure you want to compare), and compare it to the value of the day after. Take the average of these forecast errors in your historical sample, and select the model/procedure reaching the minimal forecast error.
