Added CalculateNextEMA

Extracted inline logic for CalculateNextEMA.