-1

What is the formula of Exponential Moving Average (EMA) in Google sheet ?

How it can be used to calculate Share market stock EMA of different period. Eg 5, 21, 50 Days.

Can anyone share Demo sheet.

1

You can use this function:

/**
 * Calculates the Exponential Moving Average of the range.
 *
 * @param {range} range The range of cells to calculate.
 * @param {number} n The number of trailing samples to give higer weight to, e.g. 30.
 * @return The EMA of the range.
 * @customfunction
 */
function EMA(range, n) {
  if (!range.reduce) return range;
  n = Math.min(n, range.length);
  var m = 2 / (n + 1);

  return range.reduce(function(acc, x, index, array) {
    return x != "" ? (x * m + acc * (1 - m)) : acc;
  }, 0);
}

source

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.