The combination of RMS and moving average does not make much sens to me.

RMS implies a periodic signal.

Without a periodic signal you have to add some kind of windowing function to guestimate your RMS value, and that implies a full buffer to work with.

If you have a periodic signal you can do some intermediate tricks.

Just assume you're sampling a 50Hz signal @ 10ksps.

You can then calculate a RMS value based on 10000 / 50 = 200 samples.

You can then put the calculated RMS values of each set of 200 samples into a relatively small buffer, and do a moving average or exponential decaying on that.

Depending on your sampling technique and doing AC only or AC+DC you ave to manage offsets carefully.

Something else to think about:

It is intuitive to start those 200 samples at a zero crossing, and continue untill the next zero crossing, and in a perfect world this is fine.

However, in the real world this leads to relatively big errors, if the ratio does not fit perfectly.

You may have upto one sample to many, or too less of your periodic signal without knowing it.

That sample will be near the "zero" value of your RMS, which means that you effectively would have calculated a better RMS value if you divided by 199 or 201.

However. If you start the sample period of those 200 samples near the (guestimated) RMS value of your signal, then one sample to few or too many does not matter much, because the "extra" sample has (almost) the same value as the RMS value and therefore does not add an error.

You can safely calculate the RMS value from a 201 sample buffer if that 201-th sample is the same as the RMS value.

But if that 201-th sample is (near to) 0, it will introcue an error of 0.5% in your RMS calculation.