CSTM_IND module routines

Company Information Software Products TDF Market Reports Download Area take me Home

CSTM_IND.C

This module contains the indicator routines for CSTM_RPT. From the abstract view this module meant to process sequentially - globally available DATA_REC data points through the defined report template via the process_records. For each DATA_REC data value each of the defined process records while be called by sequence of their definition (they'll be called in-order). This means for DATA_REC # 1 - process records 1 to N are executed, then DATA_REC # 2 is processed, etc.. Since the process records are processed in order this means that process records can also generate data that can be further processed by subsequent process records on the same DATA_REC pass (exp. DATA_REC # 1 / process record #1 builds a output value that DATA_REC #1 / process record # 2 can then use).

All of the indicators can be thought of as objects attached to the process records. Each indicator object has two main routines - an allocate routine and a calculate routine (beginning with allocate_ & calc_ respectively). It may also have a initialize routine to reset itself between multiple data series if it needs to (these routines begin with init_). Of course there are other helper routines too. Also some indicator objects are layered on top of other indicator objects (exp. MACDs are built out of SMAs or EMAs). For this reason some indicators also have alloc_ routines that allocate, initialize and return the pointer to a virgin indicator object.

Also each indicator object internally caches the data that it is provided during the update calls so it is possible to calculate indicators of indicators. Sometimes this could be of dubious value (like calculating a stochastics indicator of a moving average), other times it can be very valuable (like a standard deviation study of any indicator).

Function init_x1
Include file CSTM_IND.H
Prototype void init_x1( void )
Remarks Initialize the cur_prc_rec's x1 indicator structure.

Function allocate_x1
Include file CSTM_IND.H
Prototype void allocate_x1( void )
Remarks Allocate a x1 indicator structure and attach it to the cur_prc_rec.

Function calc_x1
Include file CSTM_IND.H
Prototype void calc_x1( void )
Remarks Calculate the current output value for the x1 indicator attached to the cur_prc_rec.

Function store_bars_needed
Include file CSTM_IND.H
Prototype void store_bars_needed( int bars_needed )
Remarks Calculate the number of data bars needed before this indicator can start generating output values and used the value to possibly update the master bars_needed data counter.

Function bars_needed_by_secondary_srcs
Include file CSTM_IND.H
Prototype int bars_needed_by_secondary_srcs( int source_idx )
Remarks Walk back up the data source trail summing all the bars_needed by each secondary data source until we hit a file constant data source.

Function cnvt_cur_idx_2_last
Include file CSTM_IND.H
Prototype int cnvt_cur_idx_2_last( int cur , int max )
Remarks Handle decrementing a circular queue index.

Function get_last_output_value_4_cur_prc
Include file CSTM_IND.H
Prototype float get_last_output_value_4_cur_prc( void )
Remarks Fetch the last value outputed by the indicator attached to the cur_prc_rec.

Function chk_ma_lengths
Include file CSTM_IND.H
Prototype void chk_ma_lengths( int *length1 , int *length2 )
Remarks Verify (and reverse if necessary) that moving average length1 is shorter than moving average length2.

Function chk_4_ma_tests
Include file CSTM_IND.H
Prototype void chk_4_ma_tests( int output_idx , float cur_ma )
Remarks Check if the current dt_rec is testing a moving average. If it is then update the out_ptr->signal_state to show it.

Function enough_data_yet
Include file CSTM_IND.H
Prototype int enough_data_yet( int minimum_cnt )
Remarks Return TRUE if we have the minimum number of data bars to calculate this indicator. This routine will also check secondary datas source if used by the cur_prc_rec's indicator object.

Function init_sma_ptr
Include file CSTM_IND.H
Prototype void init_sma_ptr( SMA *sma_ptr )
Remarks Initialize a given simple moving average indicator structure.

Function init_sma
Include file CSTM_IND.H
Prototype void init_sma( void )
Remarks Initialize the cur_prc_rec's simple moving average indicator structure.

Function alloc_sma
Include file CSTM_IND.H
Prototype SMA *alloc_sma( int ma_length )
Remarks Allocate a simple moving average indicator structure and return it to the caller.

Function allocate_sma
Include file CSTM_IND.H
Prototype void allocate_sma( void )
Remarks Allocate a simple moving average indicator structure and attach it to the cur_prc_rec.

Function update_sma
Include file CSTM_IND.H
Prototype void update_sma( SMA *sma_ptr , float data )
Remarks Update the given simple moving average indicator structure with the provided data.

Function calc_sma
Include file CSTM_IND.H
Prototype void calc_sma( void )
Remarks Calculate the current output value for the simple moving average indicator attached to the cur_prc_rec.

Function init_ema_ptr
Include file CSTM_IND.H
Prototype void init_ema_ptr( EMA *ema_ptr )
Remarks Initialize a given exponential moving average indicator structure.

Function init_ema
Include file CSTM_IND.H
Prototype void init_ema( void )
Remarks Initialize the cur_prc_rec's exponential moving average indicator structure.

Function alloc_ema
Include file CSTM_IND.H
Prototype EMA *alloc_ema( int ma_length )
Remarks Allocate a exponential moving average indicator structure and return it to the caller.

Function allocate_ema
Include file CSTM_IND.H
Prototype void allocate_ema( void )
Remarks Allocate a exponential moving average indicator structure and attach it to the cur_prc_rec.

Function update_ema
Include file CSTM_IND.H
Prototype void update_ema( EMA *ema_ptr , float data )
Remarks Update the given exponential moving average indicator structure with the provided data.

Function calc_ema
Include file CSTM_IND.H
Prototype void calc_ema( void )
Remarks Calculate the current output value for the exponential moving average indicator attached to the cur_prc_rec.

Function init_rsi
Include file CSTM_IND.H
Prototype void init_rsi( void )
Remarks Initialize the cur_prc_rec's Wilder's relative strength index indicator structure.

Function allocate_rsi
Include file CSTM_IND.H
Prototype void allocate_rsi( void )
Remarks Allocate a relative strength index indicator structure and attach it to the cur_prc_rec.

Function calc_rsi
Include file CSTM_IND.H
Prototype void calc_rsi( void )
Remarks Calculate the current output value for the relative strength index indicator attached to the cur_prc_rec.

Function init_shift_data
Include file CSTM_IND.H
Prototype void init_shift_data( void )
Remarks Initialize the cur_prc_rec's shift data forward indicator structure.

Function allocate_shift_data
Include file CSTM_IND.H
Prototype void allocate_shift_data( void )
Remarks Allocate a shift data indicator structure and attach it to the cur_prc_rec.

Function calc_shift_data
Include file CSTM_IND.H
Prototype void calc_shift_data( void )
Remarks Calculate the current output value for the shift data indicator attached to the cur_prc_rec.

Function init_macd
Include file CSTM_IND.H
Prototype void init_macd( void )
Remarks Initialize the cur_prc_rec's MACD (Moving Average Convergence / Divergence ) indicator structure.

Function alloc_macd
Include file CSTM_IND.H
Prototype MACD *alloc_macd( int ma_length1 , int ma_length2 , int trigger )
Remarks Allocate a new MACD indicator structure and return it to the caller.

Function allocate_macd
Include file CSTM_IND.H
Prototype void allocate_macd( void )
Remarks Allocate a MACD indicator structure and attach it to the cur_prc_rec.

Function calc_emacd
Include file CSTM_IND.H
Prototype void calc_emacd( MACD *macd_ptr , float data )
Remarks Calculate a new output value for the given exponential MACD indicator structure using the provided data.

Function calc_smacd
Include file CSTM_IND.H
Prototype void calc_smacd( MACD *macd_ptr , float data )
Remarks Calculate a new output value for the given simple MACD indicator structure using the provided data.

Function calc_macd
Include file CSTM_IND.H
Prototype void calc_macd( void )
Remarks Calculate the current output value for the MACD indicator attached to the cur_prc_rec.

Function allocate_macdh
Include file CSTM_IND.H
Prototype void allocate_macdh( void )
Remarks Allocate a MACDH (Moving Average Convergence / Divergence Histogram) indicator structure and attach it to the cur_prc_rec.

Function calc_macdh
Include file CSTM_IND.H
Prototype void calc_macdh( void )
Remarks Calculate the current output value for the MACDH indicator attached to the cur_prc_rec.

Function init_hhigh
Include file CSTM_IND.H
Prototype void init_hhigh( void )
Remarks Initialize the cur_prc_rec's highest high in N bars indicator structure.

Function allocate_hhigh
Include file CSTM_IND.H
Prototype void allocate_hhigh( void )
Remarks Allocate a highest high in N bars indicator structure and attach it to the cur_prc_rec.

Function calc_hhigh
Include file CSTM_IND.H
Prototype void calc_hhigh( void )
Remarks Calculate the current output value for the highest high in N bars indicator attached to the cur_prc_rec.

Function init_llow
Include file CSTM_IND.H
Prototype void init_llow( void )
Remarks Initialize the cur_prc_rec's lowest low in N bars indicator structure.

Function allocate_llow
Include file CSTM_IND.H
Prototype void allocate_llow( void )
Remarks Allocate a lowest low in N bars indicator structure and attach it to the cur_prc_rec.

Function calc_llow
Include file CSTM_IND.H
Prototype void calc_llow( void )
Remarks Calculate the current output value for the lowest low in N bars indicator attached to the cur_prc_rec.

Function allocate_change
Include file CSTM_IND.H
Prototype void allocate_change( void )
Remarks Allocate a net change indicator structure and attach it to the cur_prc_rec.

Function calc_change
Include file CSTM_IND.H
Prototype void calc_change( void )
Remarks Calculate the current output value for the net change indicator attached to the cur_prc_rec.

Function allocate_pchange
Include file CSTM_IND.H
Prototype void allocate_pchange( void )
Remarks Allocate a percent change indicator structure and attach it to the cur_prc_rec.

Function calc_pchange
Include file CSTM_IND.H
Prototype void calc_pchange( void )
Remarks Calculate the current output value for the percent change indicator attached to the cur_prc_rec.

Function allocate_range
Include file CSTM_IND.H
Prototype void allocate_range( void )
Remarks Allocate a DATA_REC actual range indicator structure and attach it to the cur_prc_rec.

Function calc_range
Include file CSTM_IND.H
Prototype void calc_range( void )
Remarks Calculate the current output value for the DATA_REC actual range indicator attached to the cur_prc_rec.

Function allocate_trange
Include file CSTM_IND.H
Prototype void allocate_trange( void )
Remarks Allocate a DATA_REC true range indicator structure and attach it to the cur_prc_rec.

Function calc_trange
Include file CSTM_IND.H
Prototype void calc_trange( void )
Remarks Calculate the current output value for the DATA_REC true range indicator attached to the cur_prc_rec.

Function init_stoc
Include file CSTM_IND.H
Prototype void init_stoc( void )
Remarks Initialize the cur_prc_rec's stochastics indicator structure.

Function alloc_stoc
Include file CSTM_IND.H
Prototype STOC *alloc_stoc( int stoc_length , int k_ma_length , int d_ma_length )
Remarks Allocate a stochastics indicator structure and return it to the caller.

Function allocate_stoc
Include file CSTM_IND.H
Prototype void allocate_stoc( void )
Remarks Allocate a stochastics indicator structure and attach it to the cur_prc_rec.

Function calc_stoc
Include file CSTM_IND.H
Prototype void calc_stoc( void )
Remarks Calculate the current output value for the stochastics indicator attached to the cur_prc_rec.

Function get_highs_and_lows
Include file CSTM_IND.H
Prototype void get_highs_and_lows( STOC *stoc_ptr )
Remarks Find the highest high and lowest low in the data points cached in the stochastic indicator object.

Function store_stoc_data
Include file CSTM_IND.H
Prototype void store_stoc_data( STOC *stoc_ptr )
Remarks Store the cur_prc_rec data source into the internal cache in the stochastics indicator structure.

Function allocate_wclose
Include file CSTM_IND.H
Prototype void allocate_wclose( void )
Remarks Allocate a weighted close indicator structure and attach it to the cur_prc_rec.

Function calc_wclose
Include file CSTM_IND.H
Prototype void calc_wclose( void )
Remarks Calculate the current output value for the weighted close indicator attached to the cur_prc_rec.

Function allocate_dmac
Include file CSTM_IND.H
Prototype void allocate_dmac( void )
Remarks Allocate a Dual Moving Average Crossover indicator structure and attach it to the cur_prc_rec.

Function calc_dmac
Include file CSTM_IND.H
Prototype void calc_dmac( void )
Remarks Calculate the current output value for the Dual Moving Average Crossover indicator attached to the cur_prc_rec.

Function allocate_wr
Include file CSTM_IND.H
Prototype void allocate_wr( void )
Remarks Allocate a Williams' percent R indicator structure and attach it to the cur_prc_rec.

Function calc_wr
Include file CSTM_IND.H
Prototype void calc_wr( void )
Remarks Calculate the current output value for the Williams' % R indicator attached to the cur_prc_rec.

Function init_cci
Include file CSTM_IND.H
Prototype void init_cci( void )
Remarks Calculate the current output value for the Commodity Channel Index indicator attached to the cur_prc_rec.

Function allocate_cci
Include file CSTM_IND.H
Prototype void allocate_cci( void )
Remarks Allocate a Commodity Channel Index indicator structure and attach it to the cur_prc_rec.

Function calc_cci
Include file CSTM_IND.H
Prototype void calc_cci( void )
Remarks Calculate the current output value for the Commodity Channel Index indicator attached to the cur_prc_rec.

Function alloc_stddev
Include file CSTM_IND.H
Prototype STDDEV *alloc_stddev( int max )
Remarks Allocate a standard deviation indicator and return it to the caller.

Function init_stddev
Include file CSTM_IND.H
Prototype void init_stddev( STDDEV *stddev_ptr )
Remarks Initialize the given standard deviation indicator structure.

Function update_stddev
Include file CSTM_IND.H
Prototype void update_stddev( STDDEV *stddev_ptr , float new_data )
Remarks Update the given standard deviation indicator structure with the provided data.

Function init_bb
Include file CSTM_IND.H
Prototype void init_bb( void )
Remarks Initialize the cur_prc_rec's Bollinger Bands indicator structure.

Function allocate_bb
Include file CSTM_IND.H
Prototype void allocate_bb( void )
Remarks Allocate a Bollinger Band indicator structure and attach it to the cur_prc_rec.

Function calc_bb
Include file CSTM_IND.H
Prototype void calc_bb( void )
Remarks Calculate the current output value for the Bollinger Band indicator attached to the cur_prc_rec.

Function init_sdev
Include file CSTM_IND.H
Prototype void init_sdev( void )
Remarks Initialize the cur_prc_rec's standard deviation indicator structure.

Function allocate_stddev
Include file CSTM_IND.H
Prototype void allocate_stddev( void )
Remarks Allocate a standard deviation indicator structure and attach it to the cur_prc_rec.

Function calc_stddev
Include file CSTM_IND.H
Prototype void calc_stddev( void )
Remarks Calculate the current output value for the standard deviation indicator attached to the cur_prc_rec.

Function allocate_recnum
Include file CSTM_IND.H
Prototype void allocate_recnum( void )
Remarks Allocate a report record number indicator structure and attach it to the cur_prc_rec.

Function calc_recnum
Include file CSTM_IND.H
Prototype void calc_recnum( void ) // no calc - just dump the real record number
Remarks Calculate the current output value for the report record number indicator attached to the cur_prc_rec.

Function init_sum_n
Include file CSTM_IND.H
Prototype void init_sum_n( void )
Remarks Initialize the cur_prc_rec's N bar summation indicator structure.

Function allocate_sum_n
Include file CSTM_IND.H
Prototype void allocate_sum_n( void )
Remarks Allocate a N bar summation indicator structure and attach it to the cur_prc_rec.

Function calc_sum_n
Include file CSTM_IND.H
Prototype void calc_sum_n( void )
Remarks Calculate the current output value for the N bar summation indicator attached to the cur_prc_rec.

Function init_sum
Include file CSTM_IND.H
Prototype void init_sum( void )
Remarks Initialize the cur_prc_rec's total summation indicator structure.

Function allocate_sum
Include file CSTM_IND.H
Prototype void allocate_sum( void )
Remarks Allocate a total summation indicator structure and attach it to the cur_prc_rec.

Function calc_sum
Include file CSTM_IND.H
Prototype void calc_sum( void )
Remarks Calculate the current output value for the total summation indicator attached to the cur_prc_rec.

Function init_roc
Include file CSTM_IND.H
Prototype void init_roc( void )
Remarks Initialize the cur_prc_rec's Rate Of Change indicator structure.

Function allocate_roc
Include file CSTM_IND.H
Prototype void allocate_roc( void )
Remarks Allocate a Rate Of Change indicator structure and attach it to the cur_prc_rec.

Function calc_roc
Include file CSTM_IND.H
Prototype void calc_roc( void )
Remarks Calculate the current output value for the Rate Of Change indicator attached to the cur_prc_rec.

Function init_mom
Include file CSTM_IND.H
Prototype void init_mom( void )
Remarks Initialize the cur_prc_rec's Momentum indicator structure.

Function allocate_mom
Include file CSTM_IND.H
Prototype void allocate_mom( void )
Remarks Allocate a momentum indicator structure and attach it to the cur_prc_rec.

Function calc_mom
Include file CSTM_IND.H
Prototype void calc_mom( void )
Remarks Calculate the current output value for the momentum indicator attached to the cur_prc_rec.

Table of Contents Function Index

generated on 08 February 1998 - 14:41:35
© 1998 Tierra del Fuego Ltd.