# Window Aggregate EMA C Function

> The Exponential Moving Average (EMA) C API `mco_seq_window_agg_ema_TYPE()` calculates the EMA using the algorithm described in the Window Aggregate EMA page.

> ## Example

> Following is an example code snippet demonstrating this function:

>         {
>             mco_trans_h trans;
>             mco_cursor_t quote_cursor;
>             Quote quote;
>             mco_seq_iterator_t close_iterator, ema_iterator;
>             MCO_RET rc;
>             ...

>             for (rc = mco_cursor_first(trans, &quote_cursor);
>                 rc != MCO_S_CURSOR_END;
>                 rc = mco_cursor_next(trans, &quote_cursor))
>             {
>                 Quote_from_cursor(trans, &quote_cursor, &quote);
>                 Quote_close_iterator(&quote, &close_iterator);

>                 mco_seq_window_agg_ema_float(&ema_iterator, &close_iterator[0], 7);

>                 ...
>             }
>             mco_trans_commit(trans);
>         }