The Average True Range (ATR) C API
mco_seq_window_agg_atr_TYPE()calculates the ATR using the True Range algorithm described in the Window Aggregate ATR 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, atr_iterator; MCO_RET rc; ... for (rc = mco_cursor_first(trans, "e_cursor); rc != MCO_S_CURSOR_END; rc = mco_cursor_next(trans, "e_cursor)) { Quote_from_cursor(trans, "e_cursor, "e); Quote_close_iterator("e, &close_iterator); mco_seq_window_agg_atr_float(&atr_iterator, &close_iterator[0], 7); ... } mco_trans_commit(trans); }