How do you do signal averaging on a realtime data? Smoothing algorithms implemented by me  


Exponential smoothing - https://www.openprocessing.org/sketch/771368
Moving Mean - https://www.openprocessing.org/sketch/540696


For example - a1+a2+a3+a4+... aN = A/N ..... is an average of all the a's which isn't same as ---> (((a/1+a2)/2 + a3)/3 +a4)/2 .... so on... 

can anyone explain me how wrong I am or explain me signal averaging correctly?
@Greyfrog. Here are the descriptions of four different kinds of averaging operations: