|
|
|
|
| Function | new_sma_struct |
| Include file | MV_AVG_R.H |
| Prototype | SMA * new_sma_struct( int ma_length ) |
| Remarks | Allocate, initialize and return a virgin simple moving average structure. |
![]()
| Function | reset_sma_struct |
| Include file | MV_AVG_R.H |
| Prototype | void reset_sma_struct( SMA *sma_ptr ) |
| Remarks | Reset a SMA data structure for a new data series. |
![]()
| Function | update_sma_struct |
| Include file | MV_AVG_R.H |
| Prototype | void update_sma_struct( SMA *sma_ptr , float new_data ) |
| Remarks | Update the caller's SMA with the new data. Once we have collected enough data to calc the SMA, sma_ptr->enough_data will be set to TRUE and sma_ptr->sma can be used. |
![]()
| Function | free_sma_struct |
| Include file | MV_AVG_R.H |
| Prototype | void free_sma_struct( SMA *sma_ptr ) |
| Remarks | Return the SMA and its sub-structure memory to the system. |
![]()
| Function | calc_sma_ind |
| Include file | MV_AVG_R.H |
| Prototype | void calc_sma_ind( DATA_REC *data_ptr , int data_cnt , int which_field , float *inds , int ma_length ) |
| Remarks | Calculate a simple moving average indicator of ma_length for the requested field for the DATA_REC data series. The indicator will be built in the caller's data area inds. |
![]()
| Function | new_ema_struct |
| Include file | MV_AVG_R.H |
| Prototype | EMA * new_ema_struct( int ma_length ) |
| Remarks | Allocate, initialize and return a virgin exponential moving average structure. |
![]()
| Function | reset_ema_struct |
| Include file | MV_AVG_R.H |
| Prototype | void reset_ema_struct( EMA *ema_ptr ) |
| Remarks | Reset a EMA data structure for a new data series. |
![]()
| Function | update_ema_struct |
| Include file | MV_AVG_R.H |
| Prototype | void update_ema_struct( EMA *ema_ptr , float new_data ) |
| Remarks | Update the caller's EMA with the new data. Once we have collected enough data for the EMA to be up to speed, ema_ptr->enough_data will be set to TRUE. Since this is a EMA the var ema_ptr->ema will always have a value. |
![]()
| Function | calc_ema_ind |
| Include file | MV_AVG_R.H |
| Prototype | void calc_ema_ind( DATA_REC *data_ptr , int data_cnt , int which_field , float *inds , int ma_length ) |
| Remarks | Calculate a exponential moving average indicator of ma_length for the requested field for the DATA_REC data series. The indicator will be built in the caller's data area inds. |
![]()
| Function | calc_ema_coeff |
| Include file | MV_AVG_R.H |
| Prototype | void calc_ema_coeff( int ma_length , float *coeff_a , float *coeff_b ) |
| Remarks | Calculate the coefficients for a exponential moving average. They would be used as -> new_ema = ( new_data * coeff_a ) + ( old_ema * coeff_b ). |
![]()
| Function | shift_moving_average |
| Include file | MV_AVG_R.H |
| Prototype | void shift_moving_average( int shift_offset , int data_cnt , float *inds ) |
| Remarks | This routine will take a array of floats (which can be either moving averages or other indicators) and will shift data_cnt items by the shift_offset amount. If the shift_offset is positive the indicator series will be shifted forward in time yielding a leading indicator else if negative the series will be shift backwards in time yeilding a lagging indicator. The cells that are freed up by the shift will be set to the indicator magic cookie display value IND_VAL_INVALID so they will not be plotted. It is the caller's responsibility to insure the float array has enough room for the positive shifted values and that his count of indicators in the array are updated for the shift, for negative shifts the first shift_offset number of data items will be dropped into the bit bucket. |
![]()
![]()