i have looked for an answer to this question as it seems pretty simple, but have not been able to find anything yet. Apologies if I missed something. I have pandas version 0.1
This is a decade old but I had the exact same problem. here is a 1 line way to do what you are looking for. pandas 0.18 as been introduce so rolling mean is a bit different now, but you get the point.
avg_close = dftst.xs('close', axis=1, level=1).rolling(5).mean()
dftst[zip(avg_close.columns, ['avg_close']*len(avg_close.columns))] = avg_close