Realization SMA algoritm