Module Table of Contents
Go to Function Index
G_WIN_R.C
|
This is the graphics windows subsystem.
|
QS_WIN_R.C
|
This is the quote screen display window subsystem.
|
TTYWND_R.C
|
This is the TTY Window subsystem.
|
IP_PORTS.C
|
This is the main initialization file for the TCP & UDP PORTS subsystem.
|
TCP_PORT.C
|
This code supports read & write operations for the TCP port subsystem.
|
UOUTPORT.C
|
This code supports write operations for the UDP port subsystem.
|
U_INPORT.C
|
This code supports read operations for the UDP port subsystem.
|
DBM_PORT.C
|
These routines allow a Windows app to send debug messages out transparently to its own operation via LAN UDP broadcasting.
|
SER_PORT.C
|
This is a quick hack & slash of the serial port code from tdf_tty into a module with circular data buffering and a IP_SOCK interface.
|
SIG_DATA.C
|
Real-time parse and store routines for Signal data feed.
|
MV_AVG_R.C
|
Simple and exponential style moving average routines. Plus routines to lag or lead an indicator series.
|
AMVAVG_R.C
|
Adaptive moving average routines based on Perry Kaufman's 03/93 Futures article.
|
WMVAVG_R.C
|
Weighted moving average routines.
|
STDDEV_R.C
|
Standard deviation routines.
|
LINREG_R.C
|
Least-squares and best-fit linear regression and time series line regression indicator routines.
|
DFQREG_R.C
|
Dual frequency trigonometric regression routines.
|
MACD_R.C
|
Moving Average Convergence / Divergence and Moving Average Convergence / Divergence Histogram routines.
|
BBAND_R.C
|
Bollinger Band indicator routines.
|
RSI_R.C
|
Relative Strength Index routines.
|
STOC_R.C
|
Stochastics and Williams' %R routines prototypes and typedefs.
|
WLDPAR_R.C
|
Welles Wilder's Parabolic Time/Price indicator routines.
|
RWI_R.C
|
Mike Poulos' Random Walk Index indicator routines.
|
IND_ENG.C
|
A subsystem to easily run multiple indicators and systems in parallel against a data set and then generate a custom report for the user.
|
CSTM_IND.C
|
This module contains the indicator routines for Indicator Engine.
|
FIBPRJ_R.C
|
Routines for calculating Fibonacci price retrace and expansion projections.
|
DTFL_ACC.C
|
Standardized data file access routines to support Computrac/Metastock, CSI and ASCII data files.
|
STDBPATH.C
|
The standard database path routines.
|
WRT_DT_R.C
|
Routines to support creation, writing & updating of CompuTrac & MetaStock datafiles.
|
MEMCPTDT.C
|
These are a few routines layered on top of the standard datafile access routines to support memory caching of the master file info.
|
OUTDEV_R.C
|
The standard output_device support routines.
|
STD_CODE.C
|
This module is the home for all user-interface, standard product routines.
|
GEN_UTL.C
|
A few utility routines that don't need a whole module.
|
PRC_CNFG.C
|
A set of routines to read an ASCII configuration file and process it's data and store the info back in the caller's main() module.
|
GETARGS.C
|
Command line argument processor.
|
ERR_MSGS.C
|
Error msgs and constants for the file access and cmd line configuration routines.
|
C_DATE_R.C
|
Convert and validate DATE Routines.
|
J_DATE_R.C
|
Julian date routines.
|
MRK_DAYR.C
|
These routines will support hidden holiday tracking providing a way to check a julian date to determine if the market will be open.
|
DOS_TIME.C
|
A collection of MSDOS time and date routines.
|
CNVTBOND.C
|
Conversion routines for handling T-Bond data.
|
UTLSTR_R.C
|
A collection of useful string manipulation routines (they all expect NULL terminated strs).
|
S_PARSER.C
|
A couple very simple ANSI C parse and identify routines.
|
MY_DIR.C
|
A few wrapped MSDOS directory functions.
|
BIN_TREE.C
|
Some simple binary tree routines.
|
CIRBUF_R.C
|
A collection of routines to build and support a circular byte buffer.
|
FONTNCLR.C
|
This module's routines will create a HFONT handle for any font installed on your system suitable for used by any of the TDF_lib library defined window classes. It also defines a standard color set of RGB() values.
|
LCAPPSTR.C
|
A QND to initialize some message strings suitable for use by db_printf for LAN wide msg reporting.
|
MSBIN2IE.C
|
MicroSoft basic BINary float format 2 IEee float conversion routines.
|
PERLSUPP.C
|
Just a couple of front-ends to standard library functions to handle copying data back into perl's memory space.
|
REG_R.C
|
A few simple registry routines (but all you need - read, write & delete).
|
TDF_DLGS.C
|
A simple dialog prompt box suitable for use from perl.
|
Demonstration Programs & Useful Utilities
SNAPSHOT.C
|
A Q & D program to load 1 to 4 charts (and possible indicators) and possibly dump the chart out to disk as a bitmap file (which can be converted to a JPG by cjpeg). This is also a fine example of the G_WIN subsystem.
|
CSTM_RPT.C
|
A program to easily run multiple indicators and systems in parallel against a data set and then generate a custom report for the user.
|
DUMP_CDT.C
|
A Q & D to dump CSI & Computrac master and data files to stdout to see what I've got.
|
ANAL_CYC.C
|
A Q & D program to read a file of ASCII cycles and track where a market is in relation to them.
|
APP_MON.C
|
A Q & D program to monitor the status of multiple LAN-wide programs.
|
BLKBOARD.C
|
A nice display program featuring a udp addressable display screen suitable for black-board message display from another app.
|
QSW_DEMO.C
|
This is simple demo app for the QS_WIN (Quote Screen Windows) routines.
|
WLOGGER.C
|
A very useful little utility. It will listen to a udp port and log everything seen to a scrolling TTY window.
|
TDF_TTY.C
|
A useful little utility to real-time snarf a Signal data stream from a serial port, save the quotes and broadcast a data stream out the Ethernet to other clients.
|
WIN_APP.C
|
A nice shell to use as a hack & slash starting point for building a windows app.
|
CONS_APP.C
|
A nice shell to use as a hack & slash starting point for building a console app.
|
GRX_TEST.C
|
This is a simple testbed that I used to first develop the graphic window routines. It is included as a sample program since it shows examples of a number of low level calls into the G_WIN subsystem and direct window handling.
|
MV_AVG_R.C - MoVing AVeraGe Routines
ANSI C simple and exponential style moving average routines. This
module also contains a routine to support leading (what Joe DiNapoli
calls Key Of The Day) and lagging a moving average array or a display
indicator array.
Let's take this opportunity to show an overview to the stand-alone
indicator modules. The stand-alone indicator modules are designed to
be called by the user with the user provided data where as the CSTM_RPT
indicator routines are called by CSTM_RPT for the user. The standalone
modules all have a consistant user interface.
Each indicator will have its own typedef-ed data structure which will
contain all the internal vars necessary to calculate the indicator. This
data structure will also handle caching of the raw input data stream if
this is necessary for the calculations. There will be 2 routines for
allocation and deallocation for each indicator structure. There will also
be a reset routine to reset the internal vars for a new data series.
These routines will be of the form -
??? *new_???_struct() ; // this call may have arguments for some inds.
void free_???_struct( ??? *ind_ptr ) ;
void reset_???_struct( ??? *ind_ptr ) ;
or for example -
typedef struct { // Simple moving averages
float sma ;
int ma_length ;
int data_idx ;
int enough_data ;
float *data ; // internal data cache
} SMA ;
SMA *new_sma_struct( int ma_length ) ;
void free_sma_struct( SMA *sma_ptr ) ;
void reset_sma_struct( SMA *sma_ptr ) ;
There will also be 2 routines that you can call to get an indicator
calculated for you. The first way is with an update_???_struct() call.
The form expects your program to handle stepping through each value of
the data series but it allows you to calculate an indicator off of any
data series not just normal DATA_REC data. Of course some indicators
do require normal DATA_REC (like a stochastic which needs high, low &
close to calc). Once the indicator is up to speed the enough_data field
will be set to TRUE and the indicator can be used. For example -
void update_sma_struct( SMA *sma_ptr , float new_data ) ;
// given - float *data_array ; // loaded with some data
sma_ptr = new_sma_struct( 20 ) ;
for( i = 0 ; i < max_data_cnt ; i++ ) {
update_sma_struct( sma_ptr , data_array[ i ] ) ;
if( sma_ptr->enough_data )
printf( "SMA = %f \n" , sma_ptr->sma ) ;
}
The other form directly calculates any indicator suitable for charting.
This means that the returned indicator also contains some magic cookie
values for the graphics subsystem - IND_VAL_INVALID which means that the
indicator is not up to speed and so graphics subsystem suppresses the plot
of that data point. The indicator will either be simple float arrays for
simple indicators like SMA's or typedef-ed structures for more complicated
indicator systems like Bollinger Bands. These routines expect to given a
DATA_REC data series and a which field to use flag. The calc routine will
handle the allocation & deallocation of the low-level indicator structure
but now your program will be responsible for ownership of the higher level
indicator display structure.
void calc_sma_ind( DATA_REC *data_ptr ,
int data_cnt , int which_field , float *inds , int ma_length ) ;
// given - DATA_REC *data_array // loaded with 50 bars of some data
// and a - float *sma_20_inds ;
sma_20_inds = my_calloc( sizeof( float ) * 50 ) ;
calc_sma_ind( data_array , 50 , DF_CLOSE , sma_20_inds , 20 ) ;
// that's all you need to do and then you can
grfx = draw_cmd_chart( GRX_FULL__SCR , GRX_FG_FLT_DATA , 50 , sma_20_inds
, "SMA 20" ) ; // to display it
And here is a more complicated example -
typedef struct { // Bollinger Bands indicator display structure
float *upper_band ;
float *mean ;
float *lower_band ;
float *percent_b ;
} BBAND_IND ;
bband_ptr = new_bband_ind_struct( 20 )
calc_bband_ind( data_array , 50 , DF_CLOSE , sma_20_inds , 20 , 2.0 ) ;
// that's all you need to do and then you can
grfx = draw_cmd_chart( GRX_FULL_SCR , GRX_FG_DATA_REC , 50 , data_array ,
"Some Data with BBands" ) ;
overlay_line_plot( grfx , bband_ptr->upper_band , MA1_COLOR ) ;
overlay_line_plot( grfx , bband_ptr->mean , MA1_COLOR ) ;
overlay_line_plot( grfx , bband_ptr->lower_band , MA1_COLOR ) ;
free_bband_ind_struct( bband_ptr ) ;
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.
|
Table of Contents
Function Index
AMVAVG_R.C - Adaptive MoVing AVeraGe Routines
ANSI C adaptive moving average routines based on Perry Kaufman's
03/93 Futures article.
Function
|
new_ama_struct
|
Include file
|
AMVAVG_R.H
|
Prototype
|
AMA * new_ama_struct( int ma_length )
|
Remarks
|
Allocate, initialize and return a virgin adaptive moving average structure.
|
Function
|
reset_ama_struct
|
Include file
|
AMVAVG_R.H
|
Prototype
|
void reset_ama_struct( AMA *ama_ptr )
|
Remarks
|
Reset a AMA data structure for a new data series.
|
Function
|
update_ama_struct
|
Include file
|
AMVAVG_R.H
|
Prototype
|
void update_ama_struct( AMA *ama_ptr , float new_data )
|
Remarks
|
Update the caller's AMA with the new data. Once we have collected enough
data to calc the AMA, ama_ptr->enough_data will be set to TRUE and
ama_ptr->ama can be used.
|
Function
|
free_ama_struct
|
Include file
|
AMVAVG_R.H
|
Prototype
|
void free_ama_struct( AMA *ama_ptr )
|
Remarks
|
Return the AMA and its sub-structure memory to the system.
|
Function
|
new_ama_ind_struct
|
Include file
|
AMVAVG_R.H
|
Prototype
|
AMA_IND * new_ama_ind_struct( int data_cnt )
|
Remarks
|
Allocate, and return a virgin adaptive moving average indicator display
structure for data_cnt items.
|
Function
|
free_ama_ind_struct
|
Include file
|
AMVAVG_R.H
|
Prototype
|
void free_ama_ind_struct( AMA_IND *ama_ptr )
|
Remarks
|
Return the AMA indicator display structure and its sub-structure
memory to the system.
|
Function
|
calc_ama_ind
|
Include file
|
AMVAVG_R.H
|
Prototype
|
void calc_ama_ind( DATA_REC *data_ptr , int data_cnt ,
int which_field , AMA_IND *inds , int ma_length )
|
Remarks
|
Calculate a set adaptive moving average indicators for the requested
field of the DATA_REC data series. The indicators will be built in the
caller's AMA_IND indicator display structure inds.
|
Table of Contents
Function Index
WMVAVG_R.C - Weighted MoVing AVeraGe Routines
ANSI C weighted moving average routines.
Function
|
new_wma_struct
|
Include file
|
WMVAVG_R.H
|
Prototype
|
WMA * new_wma_struct( int ma_length )
|
Remarks
|
Allocate, initialize and return a virgin weighted moving average structure.
|
Function
|
reset_wma_struct
|
Include file
|
WMVAVG_R.H
|
Prototype
|
void reset_wma_struct( WMA *wma_ptr )
|
Remarks
|
Reset a WMA data structure for a new data series.
|
Function
|
update_wma_struct
|
Include file
|
WMVAVG_R.H
|
Prototype
|
void update_wma_struct( WMA *wma_ptr , float new_data )
|
Remarks
|
Update the caller's WMA with the new data. Once we have collected enough
data to calc the WMA, wma_ptr->enough_data will be set to TRUE and
wma_ptr->wma can be used.
|
Function
|
free_wma_struct
|
Include file
|
WMVAVG_R.H
|
Prototype
|
void free_wma_struct( WMA *wma_ptr )
|
Remarks
|
Return the WMA and its sub-structure memory to the system.
|
Function
|
calc_wma_ind
|
Include file
|
WMVAVG_R.H
|
Prototype
|
void calc_wma_ind(
DATA_REC *data_ptr , int data_cnt , int which_field , float *inds , int ma_length )
|
Remarks
|
Calculate a weighted 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.
|
Table of Contents
Function Index
STDDEV_R.C - STanDard DEViation Routines
ANSI C standard deviation routines.
Function
|
new_stddev_struct
|
Include file
|
STDDEV_R.H
|
Prototype
|
STDDEV * new_stddev_struct( int stddev_length )
|
Remarks
|
Allocate, initialize and return a virgin standard deviation structure.
|
Function
|
reset_stddev_struct
|
Include file
|
STDDEV_R.H
|
Prototype
|
void reset_stddev_struct( STDDEV *stddev_ptr )
|
Remarks
|
Reset a standard deviation data structure for a new data series.
|
Function
|
update_stddev_struct
|
Include file
|
STDDEV_R.H
|
Prototype
|
void update_stddev_struct( STDDEV *stddev_ptr , float new_data )
|
Remarks
|
Calculate a N-population standard deviation (as well as a few of other
common stat values (min, max, SMA, EMA, summ & variance) ). Once we have
collected enough data to calc the STDDEV, stddev_ptr->enough_data will be
set to TRUE and stddev_ptr->std_dev can be used.
|
Function
|
free_stddev_struct
|
Include file
|
STDDEV_R.H
|
Prototype
|
void free_stddev_struct( STDDEV *stddev_ptr )
|
Remarks
|
Return the STDDEV and its sub-structure memory to the system.
|
Table of Contents
Function Index
LINREG_R.C - LINear REGression Routines
ANSI C least-squares and best-fit linear regression and time series line
regression indicator routines.
Function
|
new_linreg_struct
|
Include file
|
LINREG_R.H
|
Prototype
|
LINREG * new_linreg_struct( void )
|
Remarks
|
Allocate and return a virgin linear regression structure.
|
Function
|
calc_linreg
|
Include file
|
LINREG_R.H
|
Prototype
|
void calc_linreg( LINREG *linreg , int data_max , float *data_ptr )
|
Remarks
|
Calculate a least-squares linear regression on the supplied data.
The parameter data_ptr is a pointer to a data series that is data_max
items long. Least-squares regression uses a sequential integer count
as the x-axis (or as the independent variable) to generate the projection
of the dependent variable (the inputed price series). So this means least
squares uses time (or bar periods if you prefer) to project prices.
|
Function
|
calc_best_fit_linreg
|
Include file
|
LINREG_R.H
|
Prototype
|
void calc_best_fit_linreg(
LINREG *linreg , int data_max , float *data_ptr_ind , float *data_ptr_dep )
|
Remarks
|
Calculate a best-fit linear regression on the supplied data. The parameters
data_ptr_ind & data_ptr_dep are pointers to data series that are data_max
items long. A best-fit linear regression uses one data series as the x-axis
(or as the independent variable) to generate the projection of the
dependent variable. This means best-fit can be used to project the prices
of one series given the past relationship of 2 prices series. For example
given the past prices of corn & soybeans - calc the regression, then given
a new price for corn you could project a new price for beans.
|
Function
|
finish_regression_calcs
|
Include file
|
LINREG_R.H
|
Prototype
|
void finish_regression_calcs( LINREG *linreg , int data_max ,
float *data_ptr , double sum_x , double sum_y , double sum_xy ,
double sum_x_sqed , double sum_y_sqed )
|
Remarks
|
This routine actually does the regression calcs after the input data has
been processed (for both regression styles).
|
Function
|
calc_new_price_with_linreg
|
Include file
|
LINREG_R.H
|
Prototype
|
float calc_new_price_with_linreg( LINREG *linreg , float cur_dep_data )
|
Remarks
|
Once you have calculated a regression on a data series, use this routine
to project the new data from the regression. This routine can use the
regression output from either least-squares or best-fit regression. Just
pass a bar number as the current dependent data value or pass an actual
price for a best_fit projection.
|
Function
|
detrend_data_series
|
Include file
|
LINREG_R.H
|
Prototype
|
void detrend_data_series( int data_cnt , float *data_ptr )
|
Remarks
|
Use a least-squares regression to remove the trend from a data series.
|
Function
|
restore_trend_2_data_series
|
Include file
|
LINREG_R.H
|
Prototype
|
void restore_trend_2_data_series(
LINREG *linreg , int data_cnt , float *data_ptr )
|
Remarks
|
Use a regression calc to restore the trend to a data series.
|
Function
|
new_tslr_struct
|
Include file
|
LINREG_R.H
|
Prototype
|
TSLR * new_tslr_struct( int tslr_length )
|
Remarks
|
Allocate, initialize and return a virgin Time Series Linear Regression
indicator structure.
|
Function
|
reset_tslr_struct
|
Include file
|
LINREG_R.H
|
Prototype
|
void reset_tslr_struct( TSLR *tslr_ptr )
|
Remarks
|
Reset a TSLR data structure for a new data series.
|
Function
|
update_tslr_struct
|
Include file
|
LINREG_R.H
|
Prototype
|
void update_tslr_struct( TSLR *tslr_ptr , float data )
|
Remarks
|
Update the caller's TSLR with the new data. Once we have collected enough
data to calc the regression, tslr_ptr->enough_data will be set to TRUE and
the tslr var can be used.
|
Function
|
free_tslr_struct
|
Include file
|
LINREG_R.H
|
Prototype
|
void free_tslr_struct( TSLR *tslr_ptr )
|
Remarks
|
Return the TSLR and its sub-structure memory to the system.
|
Function
|
new_tslr_ind_struct
|
Include file
|
LINREG_R.H
|
Prototype
|
TSLR_IND * new_tslr_ind_struct( int data_cnt )
|
Remarks
|
Allocate, and return a virgin TSLR indicator display structure
for data_cnt items.
|
Function
|
free_tslr_ind_struct
|
Include file
|
LINREG_R.H
|
Prototype
|
void free_tslr_ind_struct( TSLR_IND *tslr_ptr )
|
Remarks
|
Return the TSLR indicator display structure and its sub-structure
memory to the system.
|
Function
|
calc_tslr_ind
|
Include file
|
LINREG_R.H
|
Prototype
|
void calc_tslr_ind( DATA_REC *data_ptr , int data_cnt ,
int which_field , TSLR_IND *inds , int tslr_length )
|
Remarks
|
Calculate a Time Series least-squares Linear Regression indicator for the
requested field of the DATA_REC data series. The indicators will be built
in the caller's TSLR_IND indicator display structure inds.
|
Table of Contents
Function Index
DFQREG_R.C - Dual FreQuency trigonometric REGression Routines
ANSI C dual frequency trigonometric regression routines.
The math came from Perry Kaufman's book and the errors in the
book have been corrected.
Function
|
calc_2_freq_trig_reg
|
Include file
|
DFQREG_R.H
|
Prototype
|
FREQ2_REG * calc_2_freq_trig_reg( int data_cnt , float *inp_dt )
|
Remarks
|
Calculate a dual frequency trigonometric regression. The input
parameter inp_dt is a pointer to a array of floats of data_cnt number
of items.
|
Function
|
matrix_gaussian_elimination
|
Include file
|
DFQREG_R.H
|
Prototype
|
void matrix_gaussian_elimination(
double matrix[] , double solution[] , int row , int col )
|
Remarks
|
Will do a standard Gaussian elimination to solve any N x M array built
into a 1-dimension array..
|
Function
|
free_freq2_reg_struct
|
Include file
|
DFQREG_R.H
|
Prototype
|
void free_freq2_reg_struct( FREQ2_REG *freq2_reg_ptr )
|
Remarks
|
Return the FREQ2_REG and its sub-structure memory to the system.
|
Table of Contents
Function Index
MACD_R.C - Moving Average Convergence / Divergence Routines
ANSI C Moving Average Convergence / Divergence and Moving Average
Convergence / Divergence Histogram routines. All of the MACD routines
are front-ended by macros to provide the MACDH routines. And since an
MACD is just a dual moving average crossover with one more parameter
for a trigger line, the MACD routines have also been front-end by
another set of macros for DMAC support (the DMAC new macro will supply
a dummy value for the trigger line length). So once the enough_data is
field goes TRUE the DMAC value will be in the macd var.
For an example lets calc a McClellan Oscillator -
// given 2 float arrays of data : adv[] & decl[]
mcc_ptr = new_dmac_struct( 19 , 39 , FALSE ) ;
for( i = 0 ; 1 < 40 ; i++ )
update_dmac_struct( mcc_ptr , adv[ i ] - decl[ i ] ) ;
printf( "McClellan Osc = %4.0f \n" , mcc_ptr->macd ) ;
Function
|
new_macd_struct
|
Include file
|
MACD_R.H
|
Prototype
|
MACD * new_macd_struct(
int ma_length1 , int ma_length2 , int trigger , int sma_flag )
|
Remarks
|
Allocate, initialize and return a virgin moving average convergence /
divergence structure. This same structure is also used for calculating
MACDHs and DMACs. Set sma_flag to TRUE to calculate simple moving
averages and FALSE for exponential averages.
|
Function
|
reset_macd_struct
|
Include file
|
MACD_R.H
|
Prototype
|
void reset_macd_struct( MACD *macd_ptr )
|
Remarks
|
Reset a MACD data structure for a new data series.
|
Function
|
update_macd_struct
|
Include file
|
MACD_R.H
|
Prototype
|
void update_macd_struct( MACD *macd_ptr , float data )
|
Remarks
|
Update the caller's MACD with the new data. Once we have collected enough
data to calc the MACD, macd_ptr->enough_data will be set to TRUE and
macd_ptr->macd can be used.
|
Function
|
free_macd_struct
|
Include file
|
MACD_R.H
|
Prototype
|
void free_macd_struct( MACD *macd_ptr )
|
Remarks
|
Return the MACD and its sub-structure memory to the system.
|
Function
|
calc_emacd
|
Include file
|
MACD_R.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
|
MACD_R.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
|
new_macd_ind_struct
|
Include file
|
MACD_R.H
|
Prototype
|
MACD_IND * new_macd_ind_struct( int data_cnt )
|
Remarks
|
Allocate, and return a virgin moving average convergence / divergence
indicator display structure for data_cnt items.
|
Function
|
free_macd_ind_struct
|
Include file
|
MACD_R.H
|
Prototype
|
void free_macd_ind_struct( MACD_IND *macd_ptr )
|
Remarks
|
Return the MACD indicator display structure and its sub-structure
memory to the system.
|
Function
|
calc_macd_ind
|
Include file
|
MACD_R.H
|
Prototype
|
void calc_macd_ind(
DATA_REC *data_ptr , int data_cnt , int which_field , MACD_IND *inds ,
int ma_length1 , int ma_length2 , int trigger , int sma_flag )
|
Remarks
|
Calculate a moving average convergence / divergence indicator of
ma_length1 and ma_length2 with a trigger length of trigger for the
requested field for the DATA_REC data series. The indicator will be built
in the caller's MACD_IND indicator display structure inds. While we are
at it we'll also calc the MACD histogram.
|
Table of Contents
Function Index
BBAND_R.C - Bollinger BAND Routines
ANSI C Bollinger Band indicator routines.
Function
|
new_bband_struct
|
Include file
|
BBAND_R.H
|
Prototype
|
BBAND * new_bband_struct( int ma_length , float num_of_stddevs )
|
Remarks
|
Allocate, initialize and return a virgin Bollinger Band structure.
|
Function
|
reset_bband_struct
|
Include file
|
BBAND_R.H
|
Prototype
|
void reset_bband_struct( BBAND *bband_ptr )
|
Remarks
|
Reset a BBAND data structure for a new data series.
|
Function
|
update_bband_struct
|
Include file
|
BBAND_R.H
|
Prototype
|
void update_bband_struct( BBAND *bband_ptr , float data )
|
Remarks
|
Update the caller's BBAND with the new data. Once we have collected enough
data to calc the BBANDs, bband_ptr->enough_data will be set to TRUE and
the Bollinger band fields can be used.
|
Function
|
free_bband_struct
|
Include file
|
BBAND_R.H
|
Prototype
|
void free_bband_struct( BBAND *bband_ptr )
|
Remarks
|
Return the BBAND and its sub-structure memory to the system.
|
Function
|
new_bband_ind_struct
|
Include file
|
BBAND_R.H
|
Prototype
|
BBAND_IND * new_bband_ind_struct( int data_cnt )
|
Remarks
|
Allocate, and return a virgin Bollinger Band indicator display structure
for data_cnt items.
|
Function
|
free_bband_ind_struct
|
Include file
|
BBAND_R.H
|
Prototype
|
void free_bband_ind_struct( BBAND_IND *bband_ptr )
|
Remarks
|
Return the BBAND indicator display structure and its sub-structure
memory to the system.
|
Function
|
calc_bband_ind
|
Include file
|
BBAND_R.H
|
Prototype
|
void calc_bband_ind( DATA_REC *data_ptr , int data_cnt ,
int which_field , BBAND_IND *inds , int ma_length , float num_of_stddevs )
|
Remarks
|
Calculate a set of Bollinger Band indicators for the requested field for
the DATA_REC data series. The indicators will be built in the caller's
BBAND_IND indicator display structure inds.
|
Table of Contents
Function Index
RSI_R.C - Relative Strength Index Routines
ANSI C Relative Strength Index routines.
Function
|
new_rsi_struct
|
Include file
|
RSI_R.H
|
Prototype
|
RSI * new_rsi_struct( int rsi_length )
|
Remarks
|
Allocate, initialize and return a virgin relative strength index
structure.
|
Function
|
reset_rsi_struct
|
Include file
|
RSI_R.H
|
Prototype
|
void reset_rsi_struct( RSI *rsi_ptr )
|
Remarks
|
Reset a RSI data structure for a new data series.
|
Function
|
update_rsi_struct
|
Include file
|
RSI_R.H
|
Prototype
|
void update_rsi_struct( RSI *rsi_ptr , float new_data )
|
Remarks
|
Update the caller's RSI with the new data. Once we have collected enough
data to calc the RSI, rsi_ptr->enough_data will be set to TRUE and
rsi_ptr->rsi can be used.
|
Function
|
free_rsi_struct
|
Include file
|
RSI_R.H
|
Prototype
|
void free_rsi_struct( RSI *rsi_ptr )
|
Remarks
|
Return the RSI memory to the system.
|
Function
|
calc_rsi_ind
|
Include file
|
RSI_R.H
|
Prototype
|
void calc_rsi_ind( DATA_REC *data_ptr , int data_cnt ,
int which_field , float *inds , int rsi_length )
|
Remarks
|
Calculate a RSI indicator of rsi_length for the requested field for the
DATA_REC data series. The indicator will be built in the caller's
float inds[].
|
Table of Contents
Function Index
STOC _R.C - STOChastic Routines
ANSI C stochastics and Williams' %R routines prototypes and typedefs.
Function
|
new_stoc_struct
|
Include file
|
STOC_R.H
|
Prototype
|
STOC * new_stoc_struct( int stoc_length )
|
Remarks
|
Allocate, initialize and return a virgin stochastics structure.
|
Function
|
reset_stoc_struct
|
Include file
|
STOC_R.H
|
Prototype
|
void reset_stoc_struct( STOC *stoc_ptr )
|
Remarks
|
Reset a STOC data structure for a new data series.
|
Function
|
update_stoc_struct
|
Include file
|
STOC_R.H
|
Prototype
|
void update_stoc_struct( STOC *stoc_ptr , DATA_REC *data_ptr )
|
Remarks
|
Update the caller's STOC with the new data. Once we have collected enough
data to calc the STOC vars, stoc_ptr->enough_data will be set to TRUE and
the %K & %D and the Williams' %R fields can be used.
|
Function
|
free_stoc_struct
|
Include file
|
STOC_R.H
|
Prototype
|
void free_stoc_struct( STOC *stoc_ptr )
|
Remarks
|
Return the STOC and its sub-structure memory to the system.
|
Function
|
new_stoc_ind_struct
|
Include file
|
STOC_R.H
|
Prototype
|
STOC_IND * new_stoc_ind_struct( int data_cnt )
|
Remarks
|
Allocate, and return a virgin stochastics indicator display structure
for data_cnt items.
|
Function
|
free_stoc_ind_struct
|
Include file
|
STOC_R.H
|
Prototype
|
void free_stoc_ind_struct( STOC_IND *stoc_ptr )
|
Remarks
|
Return the STOC indicator display structure and its sub-structure
memory to the system.
|
Function
|
calc_stoc_ind
|
Include file
|
STOC_R.H
|
Prototype
|
void calc_stoc_ind(
DATA_REC *data_ptr , int data_cnt , STOC_IND *inds , int stoc_length )
|
Remarks
|
Calculate a set of stochastics indicators for the requested field for
the DATA_REC data series. The indicators will be built in the caller's
STOC_IND indicator display structure inds.
|
Table of Contents
Function Index
WLDPAR_R.C - WiLDer's PARabolic time/price indicator Routines
ANSI C routines for Welles Wilder's Parabolic Time/Price indicator.
Function
|
new_par_struct
|
Include file
|
WLDPAR_R.H
|
Prototype
|
PAR * new_par_struct( float af_step , float af_max )
|
Remarks
|
Allocate, initialize and return a virgin Wilder Parabolic Time/Price
indicator structure. Now I think most people don't play with the
acceleration step factor or the acceleration max so I have front-ended
this routine with a macro for a standard initialization without having
to pass the parameters.
|
Function
|
reset_par_struct
|
Include file
|
WLDPAR_R.H
|
Prototype
|
void reset_par_struct( PAR *par_ptr )
|
Remarks
|
Reset a PAR data structure for a new data series.
|
Function
|
update_par_struct
|
Include file
|
WLDPAR_R.H
|
Prototype
|
void update_par_struct( PAR *par_ptr , DATA_REC *data_ptr )
|
Remarks
|
Update the caller's PAR with the new data. The PAR calcs will turn-on
with the second data point and par_ptr->enough_data will be set to TRUE
and various PAR fields can be used.
|
Function
|
new_par_ind_struct
|
Include file
|
WLDPAR_R.H
|
Prototype
|
PAR_IND * new_par_ind_struct( int data_cnt )
|
Remarks
|
Allocate, and return a virgin Wilder Parabolic SAR indicator display
structure for data_cnt items.
|
Function
|
free_par_ind_struct
|
Include file
|
WLDPAR_R.H
|
Prototype
|
void free_par_ind_struct( PAR_IND *par_ptr )
|
Remarks
|
Return the PAR indicator display structure and its sub-structure
memory to the system.
|
Function
|
calc_par_ind
|
Include file
|
WLDPAR_R.H
|
Prototype
|
void calc_par_ind( DATA_REC *data_ptr , int data_cnt ,
PAR_IND *inds , float af_step , float af_max )
|
Remarks
|
Calculate the Wilder Parabolic Stop and Reverse indicators for the
user DATA_REC data series. The indicators will be built in the caller's
PAR_IND indicator display structure inds. The LONG_MRK and SHORT_MRK stops will
each be stored in their own float data array for correct plotting.
|
Table of Contents
Function Index
RWI_R.C - Random Walk Index Routines
ANSI C Mike Poulos' Random Walk Index indicator routines.
Function
|
new_rwi_struct
|
Include file
|
RWI_R.H
|
Prototype
|
RWI * new_rwi_struct( int st_length , int lt_length )
|
Remarks
|
Allocate, initialize and return a virgin random walk index structure.
|
Function
|
reset_rwi_struct
|
Include file
|
RWI_R.H
|
Prototype
|
void reset_rwi_struct( RWI *rwi_ptr )
|
Remarks
|
Reset a RWI data structure for a new data series.
|
Function
|
get_circular_index
|
Include file
|
RWI_R.H
|
Prototype
|
int get_circular_index( int cur_idx , int offset , int idx_max )
|
Remarks
|
Support a circular index in both directions.
|
Function
|
update_rwi_struct
|
Include file
|
RWI_R.H
|
Prototype
|
void update_rwi_struct( RWI *rwi_ptr , DATA_REC *data_ptr )
|
Remarks
|
Update the caller's RWI with the new data. Once we have collected enough
data to calc the RWIs, rwi_ptr->enough_data will be set to TRUE and
the 4 rwi vars can be used.
|
Function
|
free_rwi_struct
|
Include file
|
RWI_R.H
|
Prototype
|
void free_rwi_struct( RWI *rwi_ptr )
|
Remarks
|
Return the RWI and its sub-structure memory to the system.
|
Function
|
new_rwi_ind_struct
|
Include file
|
RWI_R.H
|
Prototype
|
RWI_IND * new_rwi_ind_struct( int data_cnt )
|
Remarks
|
Allocate, and return a virgin random walk index indicator display structure
for data_cnt items.
|
Function
|
free_rwi_ind_struct
|
Include file
|
RWI_R.H
|
Prototype
|
void free_rwi_ind_struct( RWI_IND *rwi_ptr )
|
Remarks
|
Return the RWI indicator display structure and its sub-structure
memory to the system.
|
Function
|
calc_rwi_ind
|
Include file
|
RWI_R.H
|
Prototype
|
void calc_rwi_ind( DATA_REC *data_ptr , int data_cnt ,
RWI_IND *inds , int st_length , int lt_length )
|
Remarks
|
Calculate a set of random walk index indicators for the DATA_REC data
series. The indicators will be built in the caller's RWI_IND indicator
display structure inds.
|
Table of Contents
Function Index
FIBPRJ_R.C - FIBonacci PROjection Routines
Routines for calculating Fibonacci price retrace and expansion
projections.
Function
|
new_fibprj_struct
|
Include file
|
FIBPRJ_R.H
|
Prototype
|
FIBPRJ * new_fibprj_struct( void )
|
Remarks
|
Allocate and return a Fibonacci price projection data structure.
|
Function
|
reset_fibprj_struct
|
Include file
|
FIBPRJ_R.H
|
Prototype
|
void reset_fibprj_struct( FIBPRJ *fibprj_ptr )
|
Remarks
|
Reset a Fibonacci price projection data structure for a new data series.
By resetting all fields you can look at fibprj_ptr->pt_c and tell if
you did a retrace or an expansion call.
|
Function
|
calc_fibonacci_expansions
|
Include file
|
FIBPRJ_R.H
|
Prototype
|
void calc_fibonacci_expansions( FIBPRJ *fibprj_ptr ,
float pt_a , float pt_b , float pt_c )
|
Remarks
|
Calculate the normal Fibonacci price expansion series for 3 data points
and while we're at it let's also call calc_fibonacci_retraces() with
data points B & C.
|
Function
|
calc_fibonacci_retraces
|
Include file
|
FIBPRJ_R.H
|
Prototype
|
void calc_fibonacci_retraces( FIBPRJ *fibprj_ptr ,
float pt_a , float pt_b )
|
Remarks
|
Calculate the normal Fibonacci price retrace series for 2 data points.
|
Table of Contents
Function Index
DTFL_ACC.C - DaTa FiLe ACCess routines
Standardized data file access routines to support Computrac/Metastock,
CSI and ASCII data files. For use by the commercial TDF product line.
At a abstract level this module is driven by ticker_strs and returns
standard records of type DATA_REC (date,high,low,close,vol,open,open_int).
It expects that the GLOBAL vars data_path & database_type have already
been setup. Random and sequential access is supported for all database
types.
standard call flow -
1. - int lookup_data_file_num()
2. - FILE *open_data_file()
3. - int get_data_record_n() and then multiple
int get_next_data_record()
Or this alternate method
1. - int lookup_data_file_num()
2. - FILE *open_data_file()
3. - int load_one_intraday_day()
There is also a lazy-mans do everything routine in MEMCPTDT.C that is
layered on this module -
1. - DATA_REC *load_last_n_data_records()
Function
|
dspy_dtfl_acc_prc_globals
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void dspy_dtfl_acc_prc_globals( void )
|
Remarks
|
Display the process global vars for module - dtfl_acc.
|
Function
|
lookup_data_file_num
|
Include file
|
DTFL_ACC.H
|
Prototype
|
int lookup_data_file_num( char *requested_ticker )
|
Remarks
|
Main first entry for this module. We need to look up the user's ticker str
in the master file, fetch the data file number and build the data file
names. This is the master dispatch routine. After lookup the GLOBAL vars
fnd_ticker & fnd_ticker_label will be filled.
|
Function
|
lookup_cpt_data_file_num
|
Include file
|
DTFL_ACC.H
|
Prototype
|
int lookup_cpt_data_file_num( char *ticker )
|
Remarks
|
The Computrac/Metastock master file lookup routine.
|
Function
|
make_data_file_name
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void make_data_file_name( int data_file_num )
|
Remarks
|
data_path/F%d.dat
|
Function
|
make_dop_file_name
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void make_dop_file_name( int data_file_num )
|
Remarks
|
data_path/F%d.dop
|
Function
|
eat_EQUIS_flag_char
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void eat_EQUIS_flag_char( char *str , int cnt )
|
Remarks
|
EQUIS adds a flag character of a "*" to the end of the master.ticker
so we need to eat it before we compare to the user's ticker_str.
|
Function
|
trim_trailing_white_space_2_cnt
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void trim_trailing_white_space_2_cnt( char *str , int cnt )
|
Remarks
|
Trim a string to only useable stuff before we compare to it.
|
Function
|
correct_CSI_ticker_error
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void correct_CSI_ticker_error( char *str , int cnt )
|
Remarks
|
CSI does not handle creating ticker fields in a Metastock master file
correctly. They don't bother to init the unused space to spaces but
they just leave it random dirty values. They just insert a single
trailing space - by them using the space as a delimiter - it means you
can't have embedded spaces in your ticker string.
|
Function
|
lookup_csi_data_file_num
|
Include file
|
DTFL_ACC.H
|
Prototype
|
int lookup_csi_data_file_num( char *ticker )
|
Remarks
|
The CSI master file lookup routine.
|
Function
|
chk_this_csi_master_rec
|
Include file
|
DTFL_ACC.H
|
Prototype
|
int chk_this_csi_master_rec( char *ticker )
|
Remarks
|
Compare the current csi_master to the user ticker, return TRUE if got_it
|
Function
|
init_data_file_temps
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void init_data_file_temps( void )
|
Remarks
|
Initialize module & subsystem variables before the data file open.
|
Function
|
open_data_file
|
Include file
|
DTFL_ACC.H
|
Prototype
|
FILE * open_data_file( void )
|
Remarks
|
Main second entry point for this module. Open the data file pointed to
by the data_file_name. After the open GLOBAL vars - num_of_data_recs,
first_date_in_file, last_date_in_file, & output_places will have been set.
Also for ASCII data we need to load the whole file now into far memory
so we can support run-time user requests for specific records.
|
Function
|
set_cpt_output_places
|
Include file
|
DTFL_ACC.H
|
Prototype
|
int set_cpt_output_places( void )
|
Remarks
|
Computrac/Metastock doesn't have a scaler conversion factor like CSI so
we need to calculate one.
|
Function
|
get_data_record_n
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void get_data_record_n(
FILE *data_file , int rec_num , DATA_REC *data_ptr )
|
Remarks
|
Main entry point # 3. Now that we have looked up the ticker and opened
the file, let's get a specific record for the user.
|
Function
|
get_next_data_record
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void get_next_data_record( FILE *data_file , DATA_REC *data_ptr )
|
Remarks
|
Main entry point # 4. Once we have first called get_data_record_n we then
can call here repeatedly to fetch the next records in the file.
|
Function
|
cnvt_cpt_data_rec
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void cnvt_cpt_data_rec( DATA_REC *data_ptr )
|
Remarks
|
Convert the current Computrac data record into the user's DATA_REC.
|
Function
|
load_one_intraday_day
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void load_one_intraday_day(
FILE *data_file , DATA_REC *data_ptr , int day_num , int bars_per_day )
|
Remarks
|
Alternate entry point to # 3 & 4. Given the day_num in the file and the
intraday bars_per_day, this routine will calc the offset into the file
and load one day's worth of intraday data.
|
Function
|
read_dop_file
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void read_dop_file( char *dop_line )
|
Remarks
|
Called by rd_ascii_data_file to process each line in a Computrac DOP file.
This routine will set the field index pointers for the data record convert.
|
Function
|
fake_for_missing_dop_file
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void fake_for_missing_dop_file( void )
|
Remarks
|
Most programs do not seem to create dop files anymore - so fake up the read
index for the missing dop file based on the record size. This of course
means the field order is fixed.
|
Function
|
store_csi_1st_rec_data
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void store_csi_1st_rec_data( char *buff )
|
Remarks
|
Convert and store the CSI vars - csi_file_end_rec_ptr, csi_max_data_ptr,
csi_highest_high & csi_lowest_low as well as the normal first_date_in_file
& last_date_in_file.
|
Function
|
cnvt_csi_data_rec
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void cnvt_csi_data_rec( DATA_REC *data_ptr )
|
Remarks
|
Convert a CSI data record into the user's DATA_REC.
|
Function
|
csi_points_2_dollars
|
Include file
|
DTFL_ACC.H
|
Prototype
|
float csi_points_2_dollars( long ltemp )
|
Remarks
|
Convert and scale a CSI data value into a normal float.
|
Function
|
csi_2byte_convert
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void csi_2byte_convert( int var , float *float_ptr )
|
Remarks
|
Convert and scale a CSI 2byte data value into a normal float.
|
Function
|
csi_3byte_convert
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void csi_3byte_convert( int var , int var2 , float *float_ptr )
|
Remarks
|
Convert and scale a CSI 3byte data value into a normal float.
|
Function
|
strncpy_n_uppercase_it
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void strncpy_n_uppercase_it( char *dest , char *src , int cnt )
|
Remarks
|
Do a normal strncpy into a local var & do a uppercase at the same time.
|
Function
|
cnvt_null_bytes_2_spaces
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void cnvt_null_bytes_2_spaces( char *dest , int cnt )
|
Remarks
|
Change embedded null bytes (which are C str terminaters) into spaces
which are harmless.
|
Function
|
print_data_struct
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void print_data_struct( DATA_REC *data_ptr )
|
Remarks
|
If we get an error during the conversion of the raw data record (CSI/CPT)
into the DATA_REC we come here to dump a debug look.
|
Function
|
print_csi_1st_recs
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void print_csi_1st_recs( void )
|
Remarks
|
If we get an error during the conversion of the 1st CSI raw data record
we come here to dump a debug look.
|
Function
|
find_last_record
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void find_last_record( FILE *file_ptr )
|
Remarks
|
Read a CSI data file backwards till the 1st non-zero close.
|
Function
|
clear_data_rec
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void clear_data_rec( DATA_REC *data_ptr )
|
Remarks
|
Clear all the fields in the user's DATA_REC before the record fetch.
|
Function
|
print_cpt_master_rec
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void print_cpt_master_rec( CPT_MASTER_REC *master )
|
Remarks
|
If log_master_2_output_device is set lookup_cpt_data_file_num will call
here to dump the current cpt_master.
|
Function
|
cnvt_DATA_REC_2_MINI
|
Include file
|
DTFL_ACC.H
|
Prototype
|
MINI_DATA_REC * cnvt_DATA_REC_2_MINI(
DATA_REC *src , MINI_DATA_REC *dest , int recs )
|
Remarks
|
Convert a normal DATA_REC (7 fields) into a MINI_DATA_REC (4 fields)
to save memory. Will do a automatic realloc if src == dest.
|
Function
|
lookup_ascii_data_file
|
Include file
|
DTFL_ACC.H
|
Prototype
|
int lookup_ascii_data_file( char *ticker )
|
Remarks
|
ASCII data files are expected to be named ticker.ext where ext is
one of [ TXT , ASC , PRN , LOG ], so if we find one we will set the
data_file_name for the future open_data_file() call.
|
Function
|
chk_4_ascii_data_file
|
Include file
|
DTFL_ACC.H
|
Prototype
|
int chk_4_ascii_data_file( char *ticker , char *ext_str )
|
Remarks
|
Check the disk for a specific ticker and extention str combination.
If we get a hit, we'll also save the fnd_ticker & fnd_ticker_label vars.
Return TRUE if found else FALSE.
|
Function
|
farrealloc
|
Include file
|
DTFL_ACC.H
|
Prototype
|
static void *farrealloc( void *old_block , ULONG bytes_needed )
|
Remarks
|
since Microsoft doesn't have a farrealloc() we need to do it ourself
nope they now got one as of V6.0 except I don't like V6.0 so take your
choice.
|
Function
|
farrealloc
|
Include file
|
DTFL_ACC.H
|
Prototype
|
|
Remarks
|
//static void far *farrealloc( void far *old_block , size_t bytes_needed )
return _frealloc( old_block , bytes_needed ) ;
|
Function
|
farrealloc
|
Include file
|
DTFL_ACC.H
|
Prototype
|
static void *farrealloc( void *old_block , size_t bytes_needed )
|
Remarks
|
For VC use the normal realloc.
|
Function
|
fetch_far_data_rec
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void fetch_far_data_rec( DATA_REC *src_ptr , DATA_REC *dest_ptr )
|
Remarks
|
Fetch a ASCII data record from far memory into the user's DATA_REC.
|
Function
|
open_n_load_ascii_data_file
|
Include file
|
DTFL_ACC.H
|
Prototype
|
FILE *open_n_load_ascii_data_file( void )
|
Remarks
|
Called by open_data_file, but will do much more. We need to load the
whole file now into memory so the user at run-time can request random
records.
|
Function
|
process_1_ascii_line
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void process_1_ascii_line( char *line )
|
Remarks
|
Called by ld_ascii_data_file to process individual ASCII data records.
|
Function
|
cnvt_commas_2_white_space
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void cnvt_commas_2_white_space( char *str )
|
Remarks
|
Convert all commas in str to harmless spaces.
|
Function
|
fetch_data_field
|
Include file
|
DTFL_ACC.H
|
Prototype
|
float fetch_data_field( DATA_REC *data_ptr , int which )
|
Remarks
|
Return the requested field from the DATA_REC (do the field switch() in one
place so everybody can reuse). The field reference constants to use in the
which parameter are - DF_DATE , DF_HIGH , DF_LOW , DF_CLOSE , DF_VOL ,
DF_OPEN & DF_OINT and are defined in DTFL_ACC.H.
|
Function
|
store_data_field
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void store_data_field( float new_data , DATA_REC *data_ptr , int which )
|
Remarks
|
Store a new data value into a requested field in a DATA_REC (do the field
switch() in one place so everybody can reuse).
|
Function
|
ld_ind_from_DATA_REC_series
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void ld_ind_from_DATA_REC_series(
float *inds , DATA_REC *data_ptr , int rec_cnt , int which )
|
Remarks
|
Load a daily data value or indicator value into a indicator data series
from a compacted DATA_REC data series. An example might be storing
|
Function
|
store_ind_in_DATA_REC_series
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void store_ind_in_DATA_REC_series(
float *inds , DATA_REC *data_ptr , int rec_cnt , int which )
|
Remarks
|
Store a daily data value or indicator value into specific field of a
DATA_REC data series to form a compacted DATA_REC data series for later
output to disk.
|
Function
|
close_data_file
|
Include file
|
DTFL_ACC.H
|
Prototype
|
void close_data_file( FILE *dt_file )
|
Remarks
|
|
Table of Contents
Function Index
STDBPATH.C - SeT DataBase PATH
The standard database path routines. These 6 routines have been broken
out from DTFL_ACC.C (which is where they belong) so programs like
FIB_CALC could use them and not suck in all the data access routines
they don't need. The define_database() call is used by programs that
don't use program configuration files. Program that do use prc_cnfg.c
will get the validate_data_type() and validate_data_path_str() called for
them from the cnfg_table and just need to call set_database_vars().
Function
|
dspy_stdbpath_prc_globals
|
Include file
|
STDBPATH.H
|
Prototype
|
void dspy_stdbpath_prc_globals( void )
|
Remarks
|
Display the process global vars for module - stdbpath.
|
Function
|
define_database
|
Include file
|
STDBPATH.H
|
Prototype
|
void define_database( char *database_type , char *database_path )
|
Remarks
|
Define and validate a database.
|
Function
|
validate_data_type
|
Include file
|
STDBPATH.H
|
Prototype
|
void validate_data_type( char *str )
|
Remarks
|
Validate the user requested data_type with the module local
char *data_types[]. Set GLOBAL var database_type with either the valid
type or DATA_UNKNOWN.
|
Function
|
validate_data_path_str
|
Include file
|
STDBPATH.H
|
Prototype
|
void validate_data_path_str( char *str )
|
Remarks
|
This routine just validates that the user str is a valid terminated file
path str. The actual validation of the data directory can't happen until
we also know the database_type so we'll have to wait till the next routine
for that. The GLOBAL var data_path will be set with its own copy of the
final str.
|
Function
|
set_database_vars
|
Include file
|
STDBPATH.H
|
Prototype
|
void set_database_vars( void )
|
Remarks
|
Set the GLOBAL vars master_rec_size & data_rec_size. Also now validate
that the data_path directory does have a master file.
|
Function
|
set_database_vars_from_registry
|
Include file
|
STDBPATH.H
|
Prototype
|
void set_database_vars_from_registry( void )
|
Remarks
|
Define and validate a database using the entries in the registry.
|
Table of Contents
Function Index
WRT_DT_R.C - WRiTe DaTa Routines
ANSI C routines to support creation, writing & updating of CompuTrac &
MetaStock datafiles. Warning though - they do not update the label field
in the master record.
Also creation & writing of ASCII files is supported.
There are 4 main entry points to this module.
output_cpt_dt_file() is used to write a data series to disk in a
binary Computrac/Metastock format. The resulting data file will
contain only the given data.
output_ascii_dt_file() is used to write a data series to disk in a
ASCII format. The resulting data file will contain only the given data.
append_cpt_dt_file() is used to append a data series to a disk file.
The data file will contain its original data plus the new data.
update_cpt_data_record() is used to update an existing data record
on disk.
update_cpt_data_record() standard call flow -
1. lookup_data_file_num() // lookup your ticker
2. open_date_file_4_update()
3. get_data_record_n() // fetch the target record
4. do your updating on the DATA_REC
5. update_cpt_data_record() // and put it back
Function
|
create_empty_data_file
|
Include file
|
WRT_DT_R.H
|
Prototype
|
V 1.4 Added create_empty_data_file()
IMPORT void init_data_file_temps( void ) ;
IMPORT void local_exit( int exit_code ) ;
IMPORT void read_dop_file( char *dop_line ) ;
IMPORT void fake_for_missing_dop_file( void ) ;
static void empty_cpt_data_file( int data_file_num ) ;
static void create_cpt_data_file( int data_file_num ) ;
static void create_cpt_dop_file( int data_file_num ) ;
static void update_cpt_master_file( CPT_MASTER_REC *mstrec_ptr , int rec_num ) ;
static void update_cpt_master_file_cnts( void ) ;
static void update_cpt_dt_file_reccnt( void ) ;
static void cnvt_DATA_REC_2_cpt_dt_format( DATA_REC *dt_ptr , long cpt_dt_recs[] ) ;
static CPT_MASTER_REC *get_cur_cpt_master_rec( void ) ;
static CPT_MASTER_REC *get_new_cpt_master_rec( char *ticker , int file_num ) ;
|
Remarks
|
|
Function
|
output_cpt_dt_file
|
Include file
|
WRT_DT_R.H
|
Prototype
|
void output_cpt_dt_file( char *dtbase_path ,
char *ticker , DATA_REC *data_ptr , int rec_cnt , int field_cnt )
|
Remarks
|
This is the only routine you need to call to get a data series dumped to
disk as a Computrac / Metastock data file. This one call will do it all
(assuming you do have a master file in the dtbase_path directory).
|
Function
|
append_cpt_dt_file
|
Include file
|
WRT_DT_R.H
|
Prototype
|
void append_cpt_dt_file(
char *ticker , DATA_REC *data , int rec_cnt , int field_cnt )
|
Remarks
|
Use this routine to append 1 to N new records to a Computrac / Metastock
data file contained in the current database directory data_path.
|
Function
|
update_cpt_data_record
|
Include file
|
WRT_DT_R.H
|
Prototype
|
void update_cpt_data_record(
FILE *data_file , DATA_REC *new_data , int rec_num )
|
Remarks
|
Update a target Computrac / Metastock data rec on disk with the user's
DATA_REC. This routine does not update the record count field in the data
file header nor the date fields in the master file so it must only be used
to update existing records.
|
Function
|
empty_cpt_data_file
|
Include file
|
WRT_DT_R.H
|
Prototype
|
static void empty_cpt_data_file( int data_file_num )
|
Remarks
|
Delete an existing data file and build a new data file with just a
file header in it.
|
Function
|
create_cpt_data_file
|
Include file
|
WRT_DT_R.H
|
Prototype
|
static void create_cpt_data_file( int data_file_num )
|
Remarks
|
Create a new data file and update the master file to reflect it.
|
Function
|
create_cpt_dop_file
|
Include file
|
WRT_DT_R.H
|
Prototype
|
static void create_cpt_dop_file( int data_file_num )
|
Remarks
|
Create a 4, 5, 6 or 7 field (as created by Metastock RT) dop file.
|
Function
|
update_cpt_master_file
|
Include file
|
WRT_DT_R.H
|
Prototype
|
static void update_cpt_master_file( CPT_MASTER_REC *mstrec_ptr , int rec_num )
|
Remarks
|
Update the disk master file with this individual master record.
|
Function
|
update_cpt_master_file_cnts
|
Include file
|
WRT_DT_R.H
|
Prototype
|
static void update_cpt_master_file_cnts( void )
|
Remarks
|
Update the master file data file number counts in the file header.
|
Function
|
update_cpt_dt_file_reccnt
|
Include file
|
WRT_DT_R.H
|
Prototype
|
static void update_cpt_dt_file_reccnt( void )
|
Remarks
|
Update the data file's record count in the file header.
|
Function
|
get_cur_cpt_master_rec
|
Include file
|
WRT_DT_R.H
|
Prototype
|
static CPT_MASTER_REC *get_cur_cpt_master_rec( void )
|
Remarks
|
Get a copy of the master file record that cpt_master_found_idx is
pointing at.
|
Function
|
get_new_cpt_master_rec
|
Include file
|
WRT_DT_R.H
|
Prototype
|
static CPT_MASTER_REC *get_new_cpt_master_rec( char *ticker , int file_num )
|
Remarks
|
Build a new master file record for this ticker.
|
Function
|
open_data_file_4_update
|
Include file
|
WRT_DT_R.H
|
Prototype
|
FILE * open_data_file_4_update( void )
|
Remarks
|
Open the data file in update mode ( "r+b" ).
|
Function
|
cnvt_DATA_REC_2_cpt_dt_format
|
Include file
|
WRT_DT_R.H
|
Prototype
|
static void cnvt_DATA_REC_2_cpt_dt_format( DATA_REC *dt_ptr , long cpt_dt_recs[] )
|
Remarks
|
Convert the DATA_REC record into a Computrac record ready to store to disk.
|
Function
|
output_ascii_dt_file
|
Include file
|
WRT_DT_R.H
|
Prototype
|
void output_ascii_dt_file(
char *out_file_name , DATA_REC *data_ptr , int rec_cnt , int out_7_field )
|
Remarks
|
Output a DATA_REC series to a ASCII file for passing to another program.
|
Function
|
calc_output_places
|
Include file
|
WRT_DT_R.H
|
Prototype
|
int calc_output_places( DATA_REC *data_ptr )
|
Remarks
|
Calculate a output_places value for a given DATA_REC data series. The
calculation is based on the first close in the series.
|
Function
|
create_empty_data_file
|
Include file
|
WRT_DT_R.H
|
Prototype
|
void create_empty_data_file( int field_cnt , char *ticker , char *desc )
|
Remarks
|
|
Function
|
create_empty_cpt_master
|
Include file
|
WRT_DT_R.H
|
Prototype
|
int create_empty_cpt_master( LPTSTR master_loc )
|
Remarks
|
|
Table of Contents
Function Index
MEMCPTDT.C - MEMory ComPuTrac DaTa fetch routines
These are a few routines layered on top of the standard datafile
access routines to support memory caching of the master file info.
The module is slightly mis-named, only Metastock memory caching
& lookup is supported (to support Computrac you just need to check
a different field).
The other major functions in this module - find_date_record_by_date()
and load_last_n_data_records() do support all database types.
Function
|
find_data_record_by_date
|
Include file
|
MEMCPTDT.H
|
Prototype
|
int find_data_record_by_date( char *date_str , char *ticker )
|
Remarks
|
Given a ticker_str and a target_date, this routine will lookup and open
the data file and do a binary search for the target date. The routine
only looks for exact hits, use find_data_record_by_date_fsearch to
forward search through a file for a target date. Returns are
FALSE (0) - ticker or record not found, -1 - bounds error
( target_date < first_date_in_file or target_date > last_date_in_file )
else the found record number. The input date_str is in MM/DD/YY format.
|
Function
|
find_data_rec_by_date_fsearch
|
Include file
|
MEMCPTDT.H
|
Prototype
|
int find_data_rec_by_date_fsearch( char *date_str , char *ticker )
|
Remarks
|
This routine will front-end find_data_record_by_date() to support forward
searching a data file for a target date. Retrys are controlled by
FIND_REC_BY_DATE_RETRY_MAX and internal to the routine, dates are handled
in julian (so 01/01/90 follows 12/31/89). The input date_str is in
MM/DD/YY format.
|
Function
|
compare_dates
|
Include file
|
MEMCPTDT.H
|
Prototype
|
static int compare_dates( float date1 , float date2 )
|
Remarks
|
A simple compare function that returns values like strcmp, 0 = match,
-1 = date1 < date2 and 1 = date1 > date2.
|
Function
|
load_last_n_data_records
|
Include file
|
MEMCPTDT.H
|
Prototype
|
DATA_REC * load_last_n_data_records( char *ticker , int last_cnt )
|
Remarks
|
Given a ticker_str this routine will lookup and open the file, calloc
a chunk of memory for the data records, load the last_cnt number of
records from the file and return the fetched data in a DATA_REC array.
|
Function
|
copy_ticker_str
|
Include file
|
MEMCPTDT.H
|
Prototype
|
static void copy_ticker_str( char far *dest , char far *src )
|
Remarks
|
Copy till the 1st WHITE space char on 2 far strs.
|
Function
|
ld_cpt_master_file_into_memory
|
Include file
|
MEMCPTDT.H
|
Prototype
|
void ld_cpt_master_file_into_memory( void )
|
Remarks
|
Load a Metastock master file into memory for fast ticker lookup. This
routine currently does not support Computrac (all you need to do to add
support is change the lookup field).
|
Function
|
free_cpt_master_file_rec
|
Include file
|
MEMCPTDT.H
|
Prototype
|
void free_cpt_master_file_rec( void )
|
Remarks
|
Return the old memory master file structure to far heap memory.
|
Function
|
mem_lookup_data_file_num
|
Include file
|
MEMCPTDT.H
|
Prototype
|
int mem_lookup_data_file_num( char *requested_ticker )
|
Remarks
|
This routine will automatically support memory caching of Metastock
master files for fast ticker lookup. If called with the GLOBAL var
database_type != DATA_METASTOCK or the GLOBAL var no_mem_lookup == TRUE
then the lookup will be performed by the standard lookup_data_file_num().
|
Function
|
find_ticker_with_wildcard_supp
|
Include file
|
MEMCPTDT.H
|
Prototype
|
int find_ticker_with_wildcard_supp( int init_flag , char *ticker_str )
|
Remarks
|
Search the master file memory structure for a user ticker_str by
calling match_str_with_wildcard_support() whichs supports embedded
"?"s as any one single character (just like MSDOS does). Call this routine
with init_flag == TRUE to get the first match, then with init_flag == FALSE
to get additional matches. Will return FALSE if no matches else TRUE if
found and GLOBAL var cpt_master_found_idx will be set to the correct index
in the master memory record of the found record.
|
Function
|
update_db_module_vars
|
Include file
|
MEMCPTDT.H
|
Prototype
|
static void update_db_module_vars( int mem_mst_idx )
|
Remarks
|
Update the data access module vars with the info from the found memory
cached master record.
|
Table of Contents
Function Index
OUTDEV_R.C - OUTput DEVice Routines
The standard output_device support routines. This module allocates
the flags and the FILE *output_device. This is the place that command
line switches of /a /o /p are all supported.
Function
|
set_output_params
|
Include file
|
OUTDEV_R.H
|
Prototype
|
void set_output_params( void )
|
Remarks
|
This routine opens the GLOBAL var FILE *output_device to point to
disk, tube or printer depending on the user's command line switches.
If the buffer_video_output == TRUE then uout_file will be set to a
temporary file in TMP. The stream output from output_device can be
displayed via dspy_video_buffered_data inside of a TTYWIN.
|
Function
|
close_output_device
|
Include file
|
OUTDEV_R.H
|
Prototype
|
void close_output_device( void )
|
Remarks
|
Will also send a FF to the printer if necessary and is smart enough to
not close the stdout.
|
Table of Contents
Function Index
STD_CODE.C - STanDard CODE routines
This module is the home for all user-interface, standard product
routines.
Function
|
my_fprintf
|
Include file
|
STD_CODE.H
|
Prototype
|
void my_fprintf( char *out_str , int start_col )
|
Remarks
|
Hook back to here for all product output, this gives us the chance to play
with the output before dumping to the output_device (out_str is expected
to be ready to go).
|
Function
|
expand_tabs_in_str_2_spaces
|
Include file
|
STD_CODE.H
|
Prototype
|
void expand_tabs_in_str_2_spaces(
int tab , int start_col , char *src , char *dest )
|
Remarks
|
Remove hardware tabs and replace/expand to spaces for consistent displays.
|
Function
|
_strtime
|
Include file
|
STD_CODE.H
|
Prototype
|
void _strtime( char *time_buff )
|
Remarks
|
These are useful little Microsoft routines that TURBOC didn't support.
Warning - you will probably need to define the environment variable
TZ (for Time Zone). Look up the routine tzset() in your C manual for
more info.
|
Function
|
_strdate
|
Include file
|
STD_CODE.H
|
Prototype
|
void _strdate( char *date_buff )
|
Remarks
|
These are useful little Microsoft routines that TURBOC didn't support.
|
Function
|
dump_copyright_notices
|
Include file
|
STD_CODE.H
|
Prototype
|
void dump_copyright_notices( char *begin_str )
|
Remarks
|
Build and dump a copyright banner with a date string in column 72 to the
output_device (& maybe stdout). If you write a program for distribution
you MUST change this banner to your name or company name.
|
Function
|
compress_cmd_ln
|
Include file
|
STD_CODE.H
|
Prototype
|
void compress_cmd_ln( char *cmd_ln )
|
Remarks
|
Take the raw MSDOS user command line and grab the program_path and the
target_drive from the 1st argument. If the user cmd_ln is longer than
70 characters, copy and drop the program_path from the cmd_ln.
|
Function
|
get_drive_num_from_str
|
Include file
|
STD_CODE.H
|
Prototype
|
int get_drive_num_from_str( char *program_path_str )
|
Remarks
|
Grab the drive code off from a program_path and return as number for
BIOS calls.
|
Function
|
display_last_W32_error
|
Include file
|
STD_CODE.H
|
Prototype
|
void display_last_W32_error( void )
|
Remarks
|
Throw up a MessageBox with the last WIN32 error.
|
Function
|
report_fatal_error
|
Include file
|
STD_CODE.H
|
Prototype
|
void report_fatal_error( char *err_str )
|
Remarks
|
Abandon all hope - ye who enter here , Thou shall never return
(will hook back to the main programs local_exit()).
|
Function
|
rpt_debug_msg
|
Include file
|
STD_CODE.H
|
Prototype
|
void rpt_debug_msg( char *msg )
|
Remarks
|
Dump a trace message to stderr if debug_flag set.
|
Function
|
rpt_msg_n_status
|
Include file
|
STD_CODE.H
|
Prototype
|
void rpt_msg_n_status( char *msg , int status )
|
Remarks
|
Dump a trace message with status value to stderr if debug_flag set.
|
Function
|
dspy_compile_version
|
Include file
|
STD_CODE.H
|
Prototype
|
void dspy_compile_version( int exit_code )
|
Remarks
|
Report program name & version, which compiler & compile date/time.
|
Function
|
dump_banner_2_output_device
|
Include file
|
STD_CODE.H
|
Prototype
|
void dump_banner_2_output_device( char *comment )
|
Remarks
|
Dump a banner comment with a timestamp to output_device (& maybe stdout).
Also dump program version & compile info, suitable as exit rundown.
|
Function
|
echo_2_stdout_if_necessary
|
Include file
|
STD_CODE.H
|
Prototype
|
void echo_2_stdout_if_necessary( char *important_msg )
|
Remarks
|
Dump a important msg to the output_device and force to stdout also if
output_device != stdout.
|
Function
|
chk_if_we_are_superuser
|
Include file
|
STD_CODE.H
|
Prototype
|
int chk_if_we_are_superuser( void )
|
Remarks
|
This routine shows a way to allow run-time program privileges in MSDOS
which doesn't directly support process privileges. This could be used
to remotely turn-on maintenance or debug modes in programs on a customer's
box.
|
Function
|
cmd_ln_args_2_str
|
Include file
|
STD_CODE.H
|
Prototype
|
void cmd_ln_args_2_str( char *str , int argc , char **argv )
|
Remarks
|
Concatenate the program command line arguments into a single string.
|
Function
|
dump_cmd_ln_2_output_device
|
Include file
|
STD_CODE.H
|
Prototype
|
void dump_cmd_ln_2_output_device( char *str )
|
Remarks
|
A simple add a \n and flush.
|
Function
|
dump_TS_cmd_ln_2_output_device
|
Include file
|
STD_CODE.H
|
Prototype
|
void dump_TS_cmd_ln_2_output_device( char *str )
|
Remarks
|
Build a nice banner string with a time stamp in column 72.
|
Function
|
chk_if_help_was_requested
|
Include file
|
STD_CODE.H
|
Prototype
|
void chk_if_help_was_requested( void )
|
Remarks
|
If the help_flag is set - use OLM to display the program's doc file.
|
Function
|
dspy_video_buffered_data
|
Include file
|
STD_CODE.H
|
Prototype
|
void dspy_video_buffered_data( void )
|
Remarks
|
If buffer_video_output is set - use a TTYWIN to display the program report file
for the user.
|
Function
|
run_modal_loop_on_window
|
Include file
|
STD_CODE.H
|
Prototype
|
void run_modal_loop_on_window( HWND hTTYWin )
|
Remarks
|
Run a modal loop with full msg dispatch on the user's window.
|
Function
|
my_tmpnam
|
Include file
|
STD_CODE.H
|
Prototype
|
void my_tmpnam(
char *file_path , char *file_extension , char *valid_tmpnam )
|
Remarks
|
A wrapped routine for tmpnam with extra's. Will build a full final
path file name and verify that the new file doesn't exist. Also include
the period in the passed in file_extension string (if you want one).
|
Function
|
olm_a_file
|
Include file
|
STD_CODE.H
|
Prototype
|
void olm_a_file( char *file_name )
|
Remarks
|
A simple wrapped routine for OLM file viewing from inside a program.
|
Function
|
string_copy
|
Include file
|
STD_CODE.H
|
Prototype
|
char * string_copy( char *str )
|
Remarks
|
This a functional clone of the normal C library function strdup, except
this one uses the wrapped version of calloc().
|
Function
|
calc_avg
|
Include file
|
STD_CODE.H
|
Prototype
|
float calc_avg( float total , int divisor )
|
Remarks
|
A Q & D because MSC is unforgiving about divides by zero.
|
Function
|
calc_percentage
|
Include file
|
STD_CODE.H
|
Prototype
|
float calc_percentage( int total , int count )
|
Remarks
|
A Q & D because MSC is unforgiving about divides by zero.
|
Table of Contents
Function Index
GEN_UTL.C - GENeral UTiLity routines
A few utility routines that don't need a whole module.
Function
|
ld_ascii_data_file
|
Include file
|
GEN_UTL.H
|
Prototype
|
void ld_ascii_data_file(
char *file_name , FPTR process_routine , BOOL echo_flag )
|
Remarks
|
Load a ASCII file and call a process routine for each line of the file.
Set echo_flag to TRUE to get a debug dump to scr. If the process routine
wants to know where it is it should IMPORT and reference ASCII_line_num.
The process routine should expect one parameter, a char *. Lines beginning
with a COMMENT_CHAR (currently defined as "#") will not to sent to the
process_routine.
|
Function
|
time_stamp
|
Include file
|
GEN_UTL.H
|
Prototype
|
char * time_stamp( void )
|
Remarks
|
Get current full 26 character long date & time str from asctime.
|
Function
|
my_calloc
|
Include file
|
GEN_UTL.H
|
Prototype
|
void * my_calloc( size_t bytes_needed )
|
Remarks
|
A wrapped version of calloc, out of memory is handled as a fatal.
|
Function
|
my_farcalloc
|
Include file
|
GEN_UTL.H
|
Prototype
|
void far *my_farcalloc( ULONG bytes_needed )
|
Remarks
|
A wrapped version of farcalloc, out of memory is handled as a fatal.
|
Function
|
my_farcalloc
|
Include file
|
GEN_UTL.H
|
Prototype
|
void *my_farcalloc( size_t bytes_needed )
|
Remarks
|
|
Function
|
chk_4_file
|
Include file
|
GEN_UTL.H
|
Prototype
|
int chk_4_file( char *target_file )
|
Remarks
|
Check 4 user requested file, return TRUE if found, target_file may include
drive and directory path info.
|
Function
|
my_unlink
|
Include file
|
GEN_UTL.H
|
Prototype
|
void my_unlink( char *file_name )
|
Remarks
|
A wrapped version of unlink. Will jump to local_exit() unless GLOBAL var
return_from_lib_error == TRUE.
|
Function
|
init_ran
|
Include file
|
GEN_UTL.H
|
Prototype
|
void init_ran( void )
|
Remarks
|
This routine is used to generate a random seed for init-ing srand(), then
it calls rand() a random number of times. After calling this routine you
can count on be in a random location in the pseudorandom number sequence
generated by rand().
|
Function
|
random_int
|
Include file
|
GEN_UTL.H
|
Prototype
|
int random_int( int max_integer )
|
Remarks
|
Return a random_int in the range of 0 to max_integer.
|
Table of Contents
Function Index
PRC_CNFG.C - PRoCess run-time CoNFiGuration file
A set of routines to read an ASCII configuration file and process
it's data and store the info back in the caller's main() module.
The user program must allocate a CNF cnf_table[] and a
cnf_table_size. If config_file == NULL then use the default config
file from prc_cnfg.h. Normal use would be like -
ld_ascii_data_file( get_config_file(),process_config_file,debug_flag )
somewhere very early in the program activation. The normal default
is to ignore non-matches to the cnf_table but you can turn-on error
reporting by setting the GLOBAL var cnf_report_error to TRUE.
Function
|
get_config_file
|
Include file
|
PRC_CNFG.H
|
Prototype
|
char * get_config_file( char *file_name )
|
Remarks
|
Return either a user provided config_file name or the module subsystem
default name.
|
Function
|
set_config_table
|
Include file
|
PRC_CNFG.H
|
Prototype
|
void set_config_table( CNF *user_cnf_table , int user_cnf_table_size )
|
Remarks
|
Set the module vars to point to the user config table so that when
ld_ascii_data_file calls process_config_file( one_input_line ) the
table will be available for use.
|
Function
|
process_config_file
|
Include file
|
PRC_CNFG.H
|
Prototype
|
void process_config_file( char *file_name )
|
Remarks
|
Module entry point to get a config file processed.
|
Function
|
lc_process_config_file
|
Include file
|
PRC_CNFG.H
|
Prototype
|
static void lc_process_config_file( char *input_line )
|
Remarks
|
Called by ld_ascii_data_file to process a individual config file entry.
After preping the input_line, it will call process_one_config_entry.
|
Function
|
process_one_config_entry
|
Include file
|
PRC_CNFG.H
|
Prototype
|
static int process_one_config_entry( char *input_line )
|
Remarks
|
Lookup, validate and store one entry.
|
Function
|
lookup_config_index
|
Include file
|
PRC_CNFG.H
|
Prototype
|
static int lookup_config_index( char *token )
|
Remarks
|
Check the file token string against the CNF table. Return table index
if found else return cnf_table_size as not found.
|
Function
|
normal_cnf_table_store
|
Include file
|
PRC_CNFG.H
|
Prototype
|
static void normal_cnf_table_store( int cnf_index , char *str )
|
Remarks
|
Store a config entry back into the caller's data space.
|
Table of Contents
Function Index
GETARGS.C Command line argument processor
Function
|
getargs
|
Include file
|
GETARGS.H
|
Prototype
|
int getargs( int argc , char **argv , ARG *tbl_ptr , int tbl_size )
|
Remarks
|
Process command line arguments. Stripping all command line
switches out of argv. Return a new argc. If an error is found
local_exit(1) is called (getargs won't return) and a usage message
is printed showing all arguments in the table.
|
Function
|
stoi
|
Include file
|
GETARGS.H
|
Prototype
|
static int stoi( register char **instr )
|
Remarks
|
stoi is a more powerful version of atoi.
Convert string to integer. If string starts with 0x it is
interpreted as a hex number, else if it starts with a 0 it is
octal, else it is decimal. Conversion stops on encountering
the first character which is not a digit in the indicated
radix. *instr is updated to point past the end of the number
|
Function
|
setarg
|
Include file
|
GETARGS.H
|
Prototype
|
static char *setarg( ARG *argp , char *linep )
|
Remarks
|
Set an argument , argp points at the argument table entry
corresponding to *linep. Return linep , updated to point
past the argument being set.
|
Function
|
findarg
|
Include file
|
GETARGS.H
|
Prototype
|
static ARG *findarg( int c , ARG *tbl_ptr , int tbl_size )
|
Remarks
|
Return pointer to argument table entry corresponding
to c ( or 0 if c isn't in the table ).
|
Function
|
pr_usage
|
Include file
|
GETARGS.H
|
Prototype
|
static void pr_usage( ARG *tbl_ptr , int tbl_size , char *arg_ptr )
|
Remarks
|
Print the arg_tbl in the form:
-< arg > < errmsg > (value is < *variable > )
|
Table of Contents
Function Index
ERR_MSGS.C - ERRor MeSsaGeS routines
Error msgs and constants for the file access and cmd line
configuration routines.
Function
|
report_error_n_exit
|
Include file
|
ERR_MSGS.H
|
Prototype
|
void report_error_n_exit( int err_num )
|
Remarks
|
Dump the error message ( err_msgs[ err_num ] ) to stderr then call
local_exit.
//
|
Table of Contents
Function Index
C_DATE_R.C - Convert and validate DATE Routines.
Date formats supported are MM/DD/YY, European DD/MM/YY, and YYMMDD strings,
YYMMDD floats and UWORD julians. There are conversion routines to do any
translation. The julian conversion routines are in the julian module
J_DATE_R.C.
This module has also been updated to support year 2000 issues. A LONG
YYYYMMDD format has been added with a collection of conversion routines.
Since a single precision IEEE float only has 7 digits of accuracy 1900 -
1999 dates are mapped to 00-99 and 2000+ dates are mapped to YYYY - 1900.
Function
|
validate_date_field
|
Include file
|
C_DATE_R.H
|
Prototype
|
int validate_date_field( char *date_field )
|
Remarks
|
Front-end to validate_MM_DD_YY. This routine supports lazy user input,
given MM/DD the routine will add the current year. The year is saved and
carried over from call to call so you could enter 11/12/91 then 11/13 and
have 91 added on. The modified str is then checked by validate_MM_DD_YY.
|
Function
|
validate_MM_DD_YY
|
Include file
|
C_DATE_R.H
|
Prototype
|
int validate_MM_DD_YY( char *date_str )
|
Remarks
|
Validate the month and day fields of a MM/DD/YY date str. Return TRUE if
valid else FALSE (all INVALID - 2/29/83 | 14/02/91 | 10/44/99 ).
|
Function
|
cnvt_MM_DD_YY_2_flt
|
Include file
|
C_DATE_R.H
|
Prototype
|
float cnvt_MM_DD_YY_2_flt( char *date_str )
|
Remarks
|
Convert a MM/DD/YY date string into a float of YYMMDD.
|
Function
|
cnvt_MM_DD_YY_2_YYYYMMDD
|
Include file
|
C_DATE_R.H
|
Prototype
|
LONG cnvt_MM_DD_YY_2_YYYYMMDD( char *date_str )
|
Remarks
|
Convert a MM/DD/YY date string into a LONG of YYYYMMDD.
|
Function
|
cnvt_DD_MM_YY_2_flt
|
Include file
|
C_DATE_R.H
|
Prototype
|
float cnvt_DD_MM_YY_2_flt( char *date_str )
|
Remarks
|
Convert a European style DD/MM/YY date string into a float of YYMMDD.
|
Function
|
get_date_substr
|
Include file
|
C_DATE_R.H
|
Prototype
|
static char *get_date_substr( char *src , char *dest )
|
Remarks
|
Simple worker parse routine for cnvt_MM_DD_YY_2_flt.
|
Function
|
cnvt_YYMMDD_flt_2_MM_DD_YY
|
Include file
|
C_DATE_R.H
|
Prototype
|
char * cnvt_YYMMDD_flt_2_MM_DD_YY( float flt_date )
|
Remarks
|
Convert a YYMMDD float into a MM/DD/YY date string.
|
Function
|
cnvt_YYMMDD_flt_2_DD_MM_YY
|
Include file
|
C_DATE_R.H
|
Prototype
|
char * cnvt_YYMMDD_flt_2_DD_MM_YY( float flt_date )
|
Remarks
|
Convert a YYMMDD float into a Euro style DD/MM/YY date string.
|
Function
|
cnvt_YYMMDD_str_2_flt
|
Include file
|
C_DATE_R.H
|
Prototype
|
float cnvt_YYMMDD_str_2_flt( char *date_str )
|
Remarks
|
Convert a YYMMDD date str into a YYMMDD float.
|
Function
|
cnvt_YYMMDD_str_2_MM_DD_YY
|
Include file
|
C_DATE_R.H
|
Prototype
|
char * cnvt_YYMMDD_str_2_MM_DD_YY( char *date_str )
|
Remarks
|
Convert a YYMMDD date str into a MM/DD/YY date str
|
Function
|
cnvt_MM_DD_YY_2_YYMMDD_str
|
Include file
|
C_DATE_R.H
|
Prototype
|
char * cnvt_MM_DD_YY_2_YYMMDD_str( char *date_str )
|
Remarks
|
Convert a MM/DD/YY date str into a YYMMDD date str
|
Function
|
cnvt_YYMMDD_flt_2_YYYYMMDD
|
Include file
|
C_DATE_R.H
|
Prototype
|
LONG cnvt_YYMMDD_flt_2_YYYYMMDD( float flt_date )
|
Remarks
|
Convert a YYMMDD float date into a YYYYMMDD LONG date. Will map YY = 50 - 99
to 19??, 0 - 49 to 20?? and 100 - 199 will have 1900 added so they will map to
2000 - 2099 (exp. 1031122.0 or 31122.0 -> 20031122).
|
Function
|
cnvt_YYYYMMDD_2_YYMMDD_flt
|
Include file
|
C_DATE_R.H
|
Prototype
|
float cnvt_YYYYMMDD_2_YYMMDD_flt( LONG long_date )
|
Remarks
|
Convert a LONG YYYYMMDD date into a YYMMDD (or maybe YYYMMDD) float date.
Dates in 1900's return as 00-99, dates in 2000+ return as 100+
(exp. 20031122 -> 1031122.0 ).
|
Function
|
cnvt_YYYYMMDD_2_YYMMDD_str
|
Include file
|
C_DATE_R.H
|
Prototype
|
char * cnvt_YYYYMMDD_2_YYMMDD_str( LONG long_date )
|
Remarks
|
Convert a YYYYMMDD LONG date into a YYMMDD date str. Will just chop the
YYYY (2001) into YY (01). Useful for 6 digit report fields.
|
Function
|
cnvt_YYMMDD_flt_2_YYMMDD_str
|
Include file
|
C_DATE_R.H
|
Prototype
|
char * cnvt_YYMMDD_flt_2_YYMMDD_str( float flt_date )
|
Remarks
|
Convert a YYMMDD float date into a YYMMDD date str
|
Function
|
constant_length_date
|
Include file
|
C_DATE_R.H
|
Prototype
|
char * constant_length_date( char *date_str )
|
Remarks
|
Well not quite any more - expand day and month fields to 2 digits and
return the year field un-touched.
|
Function
|
get_field_from_YYMMDD_flt
|
Include file
|
C_DATE_R.H
|
Prototype
|
int get_field_from_YYMMDD_flt( float flt_date , int which_field )
|
Remarks
|
Fetch a field from a YYMMDD float style date and return it as an int. This
routine is front-ended by 3 macros to fetch each individual field. The
macros just need a date as a argument. They are defined in C_DATE_R.H and
are get_YY_from_YYMMDD_flt( fd ), get_MM_from_YYMMDD_flt( fd ) and
get_DD_from_YYMMDD_flt( fd )..
|
Table of Contents
Function Index
J_DATE_R.C - Julian DATE Routines
Some ANSI C Julian date routines.
Function
|
cnvt_julian_date_2_str
|
Include file
|
J_DATE_R.H
|
Prototype
|
char * cnvt_julian_date_2_str( int julian , int str_type )
|
Remarks
|
Convert a julian date into either a MM/DD/YY or YYMMDD style date str
depending on str_type. This routine is front-ended by 2 routines -
cnvt_julian_date_2_YYMMDD( jd ) and cnvt_julian_date_2_MM_DD_YY( jd )
which will worry about setting the string type. The returned str is built
in a module static char array. Each new call will overwrite the array.
If the year is between 1900 & 1999 then 1900 will be subtracted.
|
Function
|
cnvt_julian_date_2_YYMMDD
|
Include file
|
J_DATE_R.H
|
Prototype
|
char * cnvt_julian_date_2_YYMMDD( int julian_date )
|
Remarks
|
Request YYMMDD date str style from cnvt_julian_date_2_str().
|
Function
|
cnvt_julian_date_2_MM_DD_YY
|
Include file
|
J_DATE_R.H
|
Prototype
|
char * cnvt_julian_date_2_MM_DD_YY( int julian_date )
|
Remarks
|
Request DD/MM/YY date str style from cnvt_julian_date_2_str().
|
Function
|
julian_date
|
Include file
|
J_DATE_R.H
|
Prototype
|
int julian_date( char *date_str )
|
Remarks
|
Convert a date str MM/DD/YY[YY] (assumed to have been already validated) into
a julian date. If given a 2 digit year str then YY = 50 - 99 will be assumed
to mean ( year = 1900 + YY ) else YY = 0 - 49 will be assumed to mean
( year = 2000 + YY ). 3 and 4 digit year strings will be processed as given.
The returned julian date value is based with a base date of 01/01/1900 = 0.
So 179 years (or 1900 - 2079) will fit into a UWORD.
|
Function
|
cnvt_julian_date_2_YYMMDD_flt
|
Include file
|
J_DATE_R.H
|
Prototype
|
float cnvt_julian_date_2_YYMMDD_flt( int julian_date )
|
Remarks
|
Convert a julian into a float.
|
Function
|
day_of_the_week
|
Include file
|
J_DATE_R.H
|
Prototype
|
int day_of_the_week( int julian_num ) /* Sun=0 , Mon=1 ... Sat=6 */
|
Remarks
|
Convert a julian date into a day of the week offset.
|
Function
|
get_jdate_from_user
|
Include file
|
J_DATE_R.H
|
Prototype
|
int get_jdate_from_user( char *prompt_str )
|
Remarks
|
Will prompt the user with the prompt_str, fetch his input, validate it,
if valid then return the julian date else Invalid date msg to the user
and loop till he gets it right.
|
Table of Contents
Function Index
MRK_DAYR.C - MaRKet DAY Routines
These routines will support hidden holiday tracking providing
a way to check a julian date to determine if the market will be
open.
Function
|
is_mrk_day
|
Include file
|
MRK_DAYR.H
|
Prototype
|
int is_mrk_day( int j_date )
|
Remarks
|
Return TRUE if the target julian date is not a Saturday, Sunday or a
market holiday else FALSE. This routine also calls chk_if_holiday().
|
Function
|
chk_if_holiday
|
Include file
|
MRK_DAYR.H
|
Prototype
|
int chk_if_holiday( int j_date )
|
Remarks
|
Return TRUE if the target julian date is market holiday else FALSE.
Calling this routine will automatically load the holiday file.
|
Function
|
ld_holiday_file
|
Include file
|
MRK_DAYR.H
|
Prototype
|
static void ld_holiday_file()
|
Remarks
|
Load the holiday in local module memory.
|
Function
|
process_holiday_rec
|
Include file
|
MRK_DAYR.H
|
Prototype
|
static void process_holiday_rec( char *holiday_str )
|
Remarks
|
Called by ld_ascii_data_file to process an individual holiday record
from the holiday file.
|
Function
|
store_holiday_rec
|
Include file
|
MRK_DAYR.H
|
Prototype
|
static void store_holiday_rec( int holiday_j )
|
Remarks
|
Store a holiday in module memory in julian.
|
Table of Contents
Function Index
DOS_TIME.C
A collection of MSDOS time and date routines.
Function
|
get_time_in_DOS_format
|
Include file
|
DOS_TIME.H
|
Prototype
|
UWORD get_time_in_DOS_format( void )
|
Remarks
|
Get the 16 bit MSDOS time value.
|
Function
|
dostime_2_str
|
Include file
|
DOS_TIME.H
|
Prototype
|
char * dostime_2_str( UWORD dostime , char *buff )
|
Remarks
|
Convert a 16 MSDOS time value into a HH:MM:SS str in the user buffer.
|
Function
|
tm_2_MM_DD_YY
|
Include file
|
DOS_TIME.H
|
Prototype
|
void tm_2_MM_DD_YY( struct tm *time , char *date_str )
|
Remarks
|
Convert a DOS tm struct to a MM/DD/YY str in the user's buffer.
|
Function
|
cnvt_tm_struct_2_dostime
|
Include file
|
DOS_TIME.H
|
Prototype
|
long cnvt_tm_struct_2_dostime( struct tm *time )
|
Remarks
|
Convert tm struct to a 32 bit MSDOS date/time value.
|
Function
|
print_tm_struct
|
Include file
|
DOS_TIME.H
|
Prototype
|
void print_tm_struct( struct tm *time )
|
Remarks
|
Print a tm struct to stdout.
|
Function
|
clear_tm_struct
|
Include file
|
DOS_TIME.H
|
Prototype
|
void clear_tm_struct( struct tm *time )
|
Remarks
|
Well not exactly clear , set the tm struct to MSDOS base time/date.
|
Table of Contents
Function Index
CNVTBOND.C - CoNVerT BOND routines
Conversion routines for handling T-Bond data.
Function
|
cnvt_tbond_data_rec_2_decimal
|
Include file
|
CNVTBOND.H
|
Prototype
|
void cnvt_tbond_data_rec_2_decimal( DATA_REC *data_ptr )
|
Remarks
|
Convert all price data fields in the caller's DATA_REC from T-Bond 32's
style to T-Bond decimal style.
|
Function
|
cnvt_tbond_data_rec_dec_to_32
|
Include file
|
CNVTBOND.H
|
Prototype
|
void cnvt_tbond_data_rec_dec_to_32( DATA_REC *data_ptr )
|
Remarks
|
Convert all price data fields in the caller's DATA_REC from T-Bond decimal
style to T-Bond 32's style.
|
Function
|
cnvt_tbond_2_decimal
|
Include file
|
CNVTBOND.H
|
Prototype
|
float cnvt_tbond_2_decimal( float bond_quote )
|
Remarks
|
Convert a T-Bond 32's data value into a decimal format. 88.08 -> 88.25
|
Function
|
cnvt_tbond_decimal_2_normal
|
Include file
|
CNVTBOND.H
|
Prototype
|
float cnvt_tbond_decimal_2_normal( float bond_quote )
|
Remarks
|
Convert a T-Bond decimal data value back into a 32's style. 87.75 -> 87.24
|
Function
|
cnvt_tbond_2_int
|
Include file
|
CNVTBOND.H
|
Prototype
|
int cnvt_tbond_2_int( float bond_quote )
|
Remarks
|
Convert a T-Bond 32's data value into integer 32's. 88.08 -> 2824
|
Function
|
cnvt_tbond_int_2_float
|
Include file
|
CNVTBOND.H
|
Prototype
|
float cnvt_tbond_int_2_float( int bond_quote )
|
Remarks
|
Convert a T-Bond interger 32 value back into a float. 2824 -> 88.08
|
Table of Contents
Function Index
UTLSTR_R.C - Utility STRing Routines
A collection of useful string manipulation routines (they all expect
NULL terminated strs).
Function
|
eat_trailing_white_space
|
Include file
|
UTLSTR_R.H
|
Prototype
|
void eat_trailing_white_space( char *str )
|
Remarks
|
Delete trailing white space from a str.
|
Function
|
cnvt_nl_2_null
|
Include file
|
UTLSTR_R.H
|
Prototype
|
void cnvt_nl_2_null( char *str )
|
Remarks
|
Replace all embedded newlines in source str with \000 (yielding
substrings in the main string).
|
Function
|
cnvt_line_to_uppercase
|
Include file
|
UTLSTR_R.H
|
Prototype
|
void cnvt_line_to_uppercase( char *str )
|
Remarks
|
Convert all characters in the string to uppercase.
|
Function
|
cnvt_line_to_lowercase
|
Include file
|
UTLSTR_R.H
|
Prototype
|
void cnvt_line_to_lowercase( char *str )
|
Remarks
|
Convert all characters in the string to lowercase.
|
Function
|
insert_str_into_str
|
Include file
|
UTLSTR_R.H
|
Prototype
|
void insert_str_into_str( char *dest , char *insert_str , int offset )
|
Remarks
|
WARNING - this routine will do a detructive insert a str into the
destination string since dest will get NULL terminated after the end of
insert str.
|
Function
|
copy_str_n_blank_pad
|
Include file
|
UTLSTR_R.H
|
Prototype
|
void copy_str_n_blank_pad( char *src , char *dest , int len )
|
Remarks
|
Copy source string to destination and pad with spaces " " till user
requested length. WARNING - this routine does not NULL terminate the
destination string.
|
Function
|
validate_with_str_array
|
Include file
|
UTLSTR_R.H
|
Prototype
|
int validate_with_str_array(
char *validate_strs[] , char *target , int cnt )
|
Remarks
|
Compare a target string to a array of strings. Return array index if
matched else cnt as not found flag. This routine is useful for validating
command verbs or user input.
|
Function
|
validate_boolean_answer
|
Include file
|
UTLSTR_R.H
|
Prototype
|
int validate_boolean_answer( char *str )
|
Remarks
|
Return TRUE if str is a valid_true [ "Y" | "YES" | "T" | "TRUE" ] else
FALSE. This routine is layered on validate_with_str_array().
|
Function
|
match_str_with_wildcard_support
|
Include file
|
UTLSTR_R.H
|
Prototype
|
int match_str_with_wildcard_support( char *match_str , char *source )
|
Remarks
|
Support embedded ?'s as any single char.
|
Function
|
safe_strcpy
|
Include file
|
UTLSTR_R.H
|
Prototype
|
void safe_strcpy( char *dest , char *source , int max_size )
|
Remarks
|
This routine is a strncpy() with NULL terminator being forced into
the destination string if necessary.
|
Table of Contents
Function Index
S_PARSER.C - Simple PARSE Routines
A couple very simple ANSI C parse and identify routines. These are meant
to do white space parses on a str to support simple vocabularies or
simple destructive converts. For complex vocabularies you should use
YACC or BISON.
Function
|
return_next_token_str
|
Include file
|
S_PARSER.H
|
Prototype
|
char * return_next_token_str(
char *source_str , int terminate_str_flag )
|
Remarks
|
This routine returns the next white space delimited token str from a
source_str. If terminate_str_flag == TRUE then the token str is NULL
terminated. This routine is init-ed on the first call by providing a
source_str on the call. On future calls pass NULL instead of a str to
fetch sequential tokens from the original str.
|
Function
|
chk_cmd_verb_table
|
Include file
|
S_PARSER.H
|
Prototype
|
int chk_cmd_verb_table(
char *parsed_verb , CMD_VB cmd_verb_tbl[] , int tbl_size )
|
Remarks
|
Check a parsed_verb against a command_verb_table, if found return
the function code found in the verb, else return MAX table as not found.
|
Table of Contents
Function Index
MY_DIR.C
A few wrapped MSDOS directory functions.
Function
|
my_mkdir
|
Include file
|
MY_DIR.H
|
Prototype
|
void my_mkdir( char *path )
|
Remarks
|
A wrapped version of mkdir. Will jump to local_exit() unless GLOBAL var
return_from_lib_error == TRUE.
|
Function
|
my_chdir
|
Include file
|
MY_DIR.H
|
Prototype
|
void my_chdir( char *dir_str )
|
Remarks
|
A wrapped version of chdir. Will jump to local_exit() unless GLOBAL var
return_from_lib_error == TRUE.
|
Function
|
my_rmdir
|
Include file
|
MY_DIR.H
|
Prototype
|
void my_rmdir( char *dir_str )
|
Remarks
|
A wrapped version of rmdir. Will jump to local_exit() unless GLOBAL var
return_from_lib_error == TRUE.
|
Table of Contents
Function Index
CSTM_RPT.C - CuSToM RePorT
A program to easily run multiple indicators and systems in parallel
against a data set and then generate a custom report for the user.
The basic program logic is that the user gives us a report template
file and 1 (or more) data ticker strings. We first process the template
file into process records. The template lines consist of file constant
verbs or action verbs. The concept is that process records process
data items into output values. Once the template file is parsed, each
of the user requested data files are loaded in turn and run against
the report template. This program uses the Indicator Engine in the
TDF_lib dll.
Function
|
WinMain
|
Include file
|
CSTM_RPT.H
|
Prototype
|
int WINAPI WinMain( HINSTANCE hInstance , HINSTANCE hPrevInstance ,
LPSTR lpCmdLine , int nCmdShow )
|
Remarks
|
Program entry point: expected command line input -
CSTM_RPT report_template_file ticker_str [ ticker_str ... ]
|
Function
|
app_exit_cleanup
|
Include file
|
CSTM_RPT.H
|
Prototype
|
void app_exit_cleanup( int exit_code )
|
Remarks
|
Master program exit catcher. All fatal library errors will also come here.
|
Function
|
dspy_debug_hook_vars
|
Include file
|
CSTM_RPT.H
|
Prototype
|
void dspy_debug_hook_vars( int exit_code )
|
Remarks
|
Display program defined debug vars at image-rundown if debug_flag == TRUE.
|
Function
|
final_exit_cleanup
|
Include file
|
CSTM_RPT.H
|
Prototype
|
void final_exit_cleanup( int exit_code )
|
Remarks
|
Do final image-rundown cleanup here. Also force debug_flag to TRUE if
exit_code != SS_NORMAL.
|
Function
|
chk_config_args
|
Include file
|
CSTM_RPT.H
|
Prototype
|
void chk_config_args( void )
|
Remarks
|
Do a check that necessary run-time stuff has been defined and that the
user command line arguments make sense.
|
Function
|
process_ticker_list_file
|
Include file
|
CSTM_RPT.H
|
Prototype
|
void process_ticker_list_file( char *ticker_file_name )
|
Remarks
|
Process a file of ticker_strs and run the defined report template against
each of them.
|
Function
|
process_1_ticker
|
Include file
|
CSTM_RPT.H
|
Prototype
|
void process_1_ticker( char *ticker_str )
|
Remarks
|
Run the defined report for one ticker.
|
Function
|
init_global_vars
|
Include file
|
CSTM_RPT.H
|
Prototype
|
void init_global_vars( void )
|
Remarks
|
Initialize the program global and permanent variables.
|
Function
|
free_global_vars
|
Include file
|
CSTM_RPT.H
|
Prototype
|
void free_global_vars( void )
|
Remarks
|
A nice hook to free global vars. Not really needed in this application.
|
Function
|
init_process_vars
|
Include file
|
CSTM_RPT.H
|
Prototype
|
void init_process_vars( void )
|
Remarks
|
Called on each pass through process_1_ticker. Init all vars needed for
defined report's process records and zero the output buckets.
|
Function
|
free_process_vars
|
Include file
|
CSTM_RPT.H
|
Prototype
|
void free_process_vars( void )
|
Remarks
|
Called at the end of each pass through process_1_ticker to free the
ticker's DATA_RECs.
|
Function
|
update_library_global_vars
|
Include file
|
CSTM_RPT.H
|
Prototype
|
void update_library_global_vars( void )
|
Remarks
|
Update the TDF_lib global vars with data from the user's command line.
|
Function
|
print_usage_cstm_rpt
|
Include file
|
CSTM_RPT.H
|
Prototype
|
void print_usage_cstm_rpt( void )
|
Remarks
|
Print a usage message for CSTM_RPT to the user.
|
Function
|
process_cmd_line_4_arguments
|
Include file
|
CSTM_RPT.H
|
Prototype
|
void process_cmd_line_4_arguments( void )
|
Remarks
|
Process the user's command line arguments into a argv array which then is
processed by the normal getargs() procedure to store the data into the
programs switch flags.
|
Function
|
control_c_handler
|
Include file
|
CSTM_RPT.H
|
Prototype
|
BOOL WINAPI control_c_handler( DWORD dwCtrlType )
|
Remarks
|
Catch Cntl C so we can exit via exit() and get a full file flush
and close on any open files as well as any local rundown.
|
Table of Contents
Function Index
SNAPSHOT.C -
A Q & D program to load 1 to 4 charts (and possible indicators) and
possibly dump the chart out to disk as a bitmap file (which can be converted
to a JPG by cjpeg). This is also a fine example of the G_WIN subsystem.
From the command line the program can be controlled to produce normal
OHLC bar charts or candlesticks or equivolume charts. The program then
displays the chart in 6 predefined production screens of various layouts
and indicators. If also has a couple of demo screens.
This program can be built 2 ways - as either a standard windows app (with
a WinMain() ) or as a console app (with a standarc C main() ). If built as
a windows app you can call it from a batch file and draw any number of
graphics windows up on the screen (see MRK_VIEW.BAT). The console app style
is used to be called from a batch file to dump bitmap files suitable for
converting in JPG for use on a web page (the program SS2.EXE is built this
way). I build a fresh daily chartbook automatically for my internal web site
this way.
TDF_Lib buyers - sorry but this program release is meant only as a demo
program of the graphics subsystem so I have AWK-ed out EPSON printer stuff
and some proprietary indicators.
Function
|
main
|
Include file
|
SNAPSHOT.H
|
Prototype
|
int main( int argc , char *argv[] )
|
Remarks
|
|
Function
|
WinMain
|
Include file
|
SNAPSHOT.H
|
Prototype
|
int WINAPI WinMain( HINSTANCE hInstance , HINSTANCE hPrevInstance ,
LPSTR lpCmdLine , int nCmdShow )
|
Remarks
|
Program entry point: expected command line input -
SNAPSHOT ticker_str
|
Function
|
update_library_global_vars
|
Include file
|
SNAPSHOT.H
|
Prototype
|
void update_library_global_vars( void )
|
Remarks
|
Update the TDF_lib global vars with data from the user's command line.
|
Function
|
print_usage
|
Include file
|
SNAPSHOT.H
|
Prototype
|
void print_usage( void )
|
Remarks
|
Print a usage message for SNAPSHOT to the user.
|
Function
|
process_cmd_line_4_arguments
|
Include file
|
SNAPSHOT.H
|
Prototype
|
void process_cmd_line_4_arguments( void )
|
Remarks
|
Process the user's command line arguments into a argv array which then is
processed by the normal getargs() procedure to store the data into the
programs switch flags.
|
Function
|
control_c_handler
|
Include file
|
SNAPSHOT.H
|
Prototype
|
BOOL WINAPI control_c_handler( DWORD dwCtrlType )
|
Remarks
|
A simple control-c handler.
|
Function
|
calc_cycle_position
|
Include file
|
SNAPSHOT.H
|
Prototype
|
float calc_cycle_position( int cycle_length , int cur_offset )
|
Remarks
|
Calculate the current position in a cycle, return x where 1 >= x >= -1
with 1 = top of the cycle & -1 = bottom of the cycle.
|
Function
|
auto_select_a_scr
|
Include file
|
SNAPSHOT.H
|
Prototype
|
void auto_select_a_scr()
|
Remarks
|
Draw a specific pre-programmed chart by command line request. Only case 1
currently defined in this demo ( 1 is setup to chart a passed-in ASCII file
from a CSTM_RPT log). In my version of this program I use about 10
pre-defined screens which are selected at call time by the calling program
for different overlays. You would use this version like this - given a
# IND_EXP.TPL - CSTM_RPT export demo template file
date # the date will log automatically
high log # will output as the second field on each line
low log # etc.
close log
vol log
rsi 14 log # this will be exported in the 6th field - open
ema 3 rsi_14 log # and this in the open interest field
# end IND_EXP.TPL
then run CSTM_RPT and request logging of the last 50 records
CSTM_RPT IND_EXP.TPL DOW /L50 /onul
this will then produce an ASCII file named CSTM_RPT.LOG containing the
exported data which can instantly displayed by using -
SNAPSHOT /A /s1 CSTM_RPT
/A means ASCII file, /s1 - auto_select scr # 1, and CSTM_RPT means that
the ASCII ticker to load is CSTM_RPT.
|
Function
|
set_display_data_rec_ptr
|
Include file
|
SNAPSHOT.H
|
Prototype
|
void set_display_data_rec_ptr( void )
|
Remarks
|
Update the display data ptr to the user requested number of records
to display.
|
Function
|
set_display_inds_ptr
|
Include file
|
SNAPSHOT.H
|
Prototype
|
float *set_display_inds_ptr( float *flt_ptr )
|
Remarks
|
Update an indicator ptr to match the number of user requested records
to display.
|
Function
|
cht_with_bband
|
Include file
|
SNAPSHOT.H
|
Prototype
|
void cht_with_bband( void )
|
Remarks
|
Draw a full window OHLC bar chart with an overlay of Bollinger bands.
|
Function
|
cht_with_par
|
Include file
|
SNAPSHOT.H
|
Prototype
|
void cht_with_par( void )
|
Remarks
|
Draw a full window OHLC bar chart with an overlay of a Wilder's parabolic
system and a 1083 channel system.
|
Function
|
test_cht_sine
|
Include file
|
SNAPSHOT.H
|
Prototype
|
void test_cht_sine( void )
|
Remarks
|
A demo routine to draw a sine wave as a histogram.
|
Function
|
register_frame_window_old
|
Include file
|
SNAPSHOT.H
|
Prototype
|
int register_frame_window_old( void )
|
Remarks
|
Support routine for the old style frame demo code.
|
Function
|
register_frame_window
|
Include file
|
SNAPSHOT.H
|
Prototype
|
int register_frame_window( void )
|
Remarks
|
Register the frame window class with a hook to our local WndProc.
|
Function
|
test_cht_2_windows
|
Include file
|
SNAPSHOT.H
|
Prototype
|
void test_cht_2_windows( void )
|
Remarks
|
Raw demo routine to drop a window into a frame window.
|
Function
|
WndProc
|
Include file
|
SNAPSHOT.H
|
Prototype
|
long CALLBACK WndProc( HWND hWnd , UINT mesg , UINT wParam , LONG lParam )
|
Remarks
|
Frame WndProc to support demo mode 98.
|
Function
|
frameWndProc
|
Include file
|
SNAPSHOT.H
|
Prototype
|
long CALLBACK frameWndProc( HWND hWnd , UINT mesg , UINT wParam , LONG lParam )
|
Remarks
|
This is the production version of the frame WndProc for supporting
build_multi_charts_in_a_frame().
|
Function
|
store_gwin_size
|
Include file
|
SNAPSHOT.H
|
Prototype
|
void store_gwin_size( GWIN_SIZE *gsize_ptr ,
double x_min , double x_max , double y_min , double y_max )
|
Remarks
|
Define the coordinates for a sub-window inside a frame window. The input
sizes are percent values from the calculated axis maximums.
|
Function
|
display_multi_charts
|
Include file
|
SNAPSHOT.H
|
Prototype
|
void display_multi_charts( void )
|
Remarks
|
This is a demo routine to build many different configurations sub-windows
inside a frame window. The examples are 2 windows split horizontally and
vertically, 3 horizontals and a quad board.
|
Function
|
build_multi_charts_in_a_frame
|
Include file
|
SNAPSHOT.H
|
Prototype
|
void build_multi_charts_in_a_frame( GWIN_SIZE *gwin_sizes , LPTSTR frame_title )
|
Remarks
|
This routine supports building N windows inside a frame window. The number
of windows is controlled by the number of records in the gwin_sizes array.
The frame window itself is allocated in the global window ptr - ggw_ptr.
And the frame windows gets labeled with the passed in frame_title.
|
Function
|
localGrfxWndProc
|
Include file
|
SNAPSHOT.H
|
Prototype
|
LONG WINAPI localGrfxWndProc( HWND hWnd , UINT mesg , UINT wParam , LONG lParam )
|
Remarks
|
The local graphics WndProc. This is currently not used - I left it in
for debug hooking.
|
Function
|
display_multi_chart_rwi
|
Include file
|
SNAPSHOT.H
|
Prototype
|
void display_multi_chart_rwi( void )
|
Remarks
|
This routine produce a combined data and indicator chart. The data chart
has both a Bollinger band series and a 1083 channel system overlayed.
And the separate indicator window has a 7 - 20 RWI.
|
Function
|
display_multi_chart_rsi
|
Include file
|
SNAPSHOT.H
|
Prototype
|
void display_multi_chart_rsi( void )
|
Remarks
|
This routine produce a combined data and indicator chart. The data chart
has both a Bollinger band series and a 1083 channel system overlayed.
And the separate indicator window has both a standard RSI and a Bollinger
%b.
|
Function
|
cht_with_bband_n_kotd
|
Include file
|
SNAPSHOT.H
|
Prototype
|
void cht_with_bband_n_kotd( void )
|
Remarks
|
Build a full size chart window with overlayed Bollinger bands and a
KOTD indicator.
|
Function
|
display_multi_chart_quad
|
Include file
|
SNAPSHOT.H
|
Prototype
|
void display_multi_chart_quad( void )
|
Remarks
|
This routine builds a quad board display. One window is a data chart with
a Bollinger band and 1083 overlay. Another window is a MACDH displayed
as a histogram. And there is a standard stochastics display. And the
last screen has an inverted Williams %R and a RSI.
|
Function
|
pre_exit_cleanup
|
Include file
|
SNAPSHOT.H
|
Prototype
|
void pre_exit_cleanup( void )
|
Remarks
|
A simple pre_exit cleanup used to free up the G_WIN ptrs and the pens
of the grfx_subsystem.
|
Table of Contents
Function Index
DUMP_CDT.C - Dump Commodity data
A Q & D to dump CSI & Computrac master and data files to stdout to
see what I've got.
Function
|
WinMain
|
Include file
|
DUMP_CDT.H
|
Prototype
|
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow )
|
Remarks
|
Program entry point: expected command line input examples -
DUMP_CDT // dump master file in current directory
DUMP_CDT a_directory_path // dump master file in given directory
DUMP_CDT a_ticker_str // dump ticker data file in the current dir
DUMP_CDT dir_path ticker_str // dump ticker data file in given dir
|
Function
|
process_cmd_line_4_arguments
|
Include file
|
DUMP_CDT.H
|
Prototype
|
void process_cmd_line_4_arguments( void )
|
Remarks
|
Process the user's command line arguments into a argv array which then is
processed by the normal getargs() procedure to store the data into the
programs switch flags.
|
Function
|
lc_local_exit
|
Include file
|
DUMP_CDT.H
|
Prototype
|
void lc_local_exit( int exit_code )
|
Remarks
|
Master program exit catcher. All fatal library errors will also come here.
|
Function
|
set_cmd_line_flags
|
Include file
|
DUMP_CDT.H
|
Prototype
|
void set_cmd_line_flags( void )
|
Remarks
|
Do a sanity test on the user inputed cmd line args.
|
Function
|
set_f_scaler
|
Include file
|
DUMP_CDT.H
|
Prototype
|
void set_f_scaler( void )
|
Remarks
|
Convert the user scale factor into a float multiplier to use.
|
Function
|
set_database_flags
|
Include file
|
DUMP_CDT.H
|
Prototype
|
void set_database_flags( void )
|
Remarks
|
Check the current directory and see what kind of master files we find.
|
Function
|
dump_the_master_file
|
Include file
|
DUMP_CDT.H
|
Prototype
|
void dump_the_master_file( char *ticker )
|
Remarks
|
Called here with a unfindable ticker string "TDF_LTD!" and with the GLOBAL
var log_master_2_output_device set to TRUE so the standard library look-up
routine lookup_data_file_num( ticker ) will dump all entries in the master
file.
|
Function
|
process_one_data_file
|
Include file
|
DUMP_CDT.H
|
Prototype
|
void process_one_data_file( char *ticker_str )
|
Remarks
|
Read, process (bond conversion &| weekly/monthly compression &| scaling)
and output the requested data file.
|
Function
|
dump_the_data_file_header
|
Include file
|
DUMP_CDT.H
|
Prototype
|
void dump_the_data_file_header( char *ticker )
|
Remarks
|
Dump the CSI or Computrac data file header information, then the output
banner line to the output_device in preparation for dumping the data file's
data.
|
Function
|
dump_cpt_data_file_header
|
Include file
|
DUMP_CDT.H
|
Prototype
|
void dump_cpt_data_file_header( char *ticker )
|
Remarks
|
Dump the Computrac/Metastock data file header information.
|
Function
|
dump_csi_data_file_header
|
Include file
|
DUMP_CDT.H
|
Prototype
|
void dump_csi_data_file_header( char *ticker )
|
Remarks
|
Dump the CSI data file header information.
|
Function
|
print_data_struct_compact
|
Include file
|
DUMP_CDT.H
|
Prototype
|
void print_data_struct_compact( DATA_REC *data_ptr )
|
Remarks
|
Dump a DATA_REC out to a single line on the output_device.
|
Function
|
scale_data_rec
|
Include file
|
DUMP_CDT.H
|
Prototype
|
void scale_data_rec( DATA_REC *data_ptr )
|
Remarks
|
Scale all the price fields in the caller's DATA_REC by muliplying them
by the user f_scaler value.
|
Function
|
init_compress_data_struct
|
Include file
|
DUMP_CDT.H
|
Prototype
|
void init_compress_data_struct( DATA_REC *data_ptr )
|
Remarks
|
Initialize all the fields in the DATA_REC that we use for compression
caching.
|
Function
|
add_2_compress_data_struct
|
Include file
|
DUMP_CDT.H
|
Prototype
|
void add_2_compress_data_struct( DATA_REC *cmp_data_ptr , DATA_REC *cur_rec_ptr )
|
Remarks
|
Update the compression structure with the current DATA_REC.
|
Function
|
calc_mth_idx
|
Include file
|
DUMP_CDT.H
|
Prototype
|
int calc_mth_idx( float date )
|
Remarks
|
Strip the month from a YYMMDD float date and return it as a int.
|
Function
|
calc_day_of_week_index
|
Include file
|
DUMP_CDT.H
|
Prototype
|
int calc_day_of_week_index( float date )
|
Remarks
|
Get a day of the week index from a YYMMDD float date.
|
Function
|
compress_day_to_week_or_month
|
Include file
|
DUMP_CDT.H
|
Prototype
|
void compress_day_to_week_or_month( DATA_REC *cmp_data_ptr , DATA_REC *cur_rec_ptr )
|
Remarks
|
Compress the daily data into the user requested size and hit the
compress_flush flag when needed.
|
Function
|
chk_if_1st_arg_is_a_db_path
|
Include file
|
DUMP_CDT.H
|
Prototype
|
int chk_if_1st_arg_is_a_db_path( int argc , char *argv[] )
|
Remarks
|
Check if the first user command line argument is a database path string.
If it is, clone it to the GLOBAL var data_path.
|
Function
|
update_library_global_vars
|
Include file
|
DUMP_CDT.H
|
Prototype
|
void update_library_global_vars( void )
|
Remarks
|
Update the TDF_lib global vars with data from the user's command line.
|
Table of Contents
Function Index
ANAL_CYC.C - ANALyze CYCle
A Q & D program to read a file of ASCII cycles and track where a
market is in relation to them. Another goal is to track what Jeff
Bower at FNN humbly calls Bower power shifts (cycle confluences).
And now cross-ref the market high/low extremes and Fibonacci time
projections from a FIB_RPT report in too.
Function
|
main
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void main( int argc , char *argv[] )
|
Remarks
|
Program entry point: expected command line input -
ANAL_CYC cycle_definition_file
|
Function
|
lc_local_exit
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void lc_local_exit( int exit_code )
|
Remarks
|
Master program exit catcher. All fatal library errors will also come here.
|
Function
|
final_exit_cleanup
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void final_exit_cleanup( int exit_code )
|
Remarks
|
Do final image-rundown cleanup here. Also force debug_flag to TRUE if
exit_code != SS_NORMAL.
|
Function
|
output_a_timestamp_msg
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void output_a_timestamp_msg( char *msg )
|
Remarks
|
Output a message with a time stamp to the tube.
|
Function
|
allocate_data_structures
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void allocate_data_structures( void )
|
Remarks
|
Allocate the program GLOBAL variables.
|
Function
|
free_data_structures
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void free_data_structures( void )
|
Remarks
|
Deallocate the program GLOBAL variables.
|
Function
|
load_cycle_data_file
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void load_cycle_data_file( char *cycle_file )
|
Remarks
|
Load and process the cycle definition data file.
|
Function
|
process_cycle_data_rec
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void process_cycle_data_rec( char *data_line )
|
Remarks
|
Called by ld_ascii_data_file to process each line of the user's cycle
definition file. This routine will dispatch to the individual verb
process routines.
|
Function
|
process_ticker_dt_rec
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void process_ticker_dt_rec( char *ticker_line )
|
Remarks
|
Process a ticker string data record from the cycle definition file.
The ticker_line will look like - "ticker dow".
|
Function
|
process_cycle_dt_rec
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void process_cycle_dt_rec( char *cycle_line )
|
Remarks
|
Process a cycle definition data record from the cycle definition file.
The cycle_line will look like - "cycle 01/03/95 25 bottom".
|
Function
|
save_cycle_rec
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void save_cycle_rec( float base_date , int length , int node_type )
|
Remarks
|
Allocate and initialize a CREC to track this individual cycle.
|
Function
|
process_blend_dt_rec
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void process_blend_dt_rec( char *blend_line )
|
Remarks
|
Process a blend cycle definition data record from the cycle definition
file. A blend is the mathematical combination of 2 or more cycles
yielding a sigmoidal curve. A blend_line will look like - "blend 10 20 30".
|
Function
|
calc_days_needed
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void calc_days_needed( void )
|
Remarks
|
Calculate the number of bars of market data we need. The controlling
variables are the longest cycle and oldest anchor_date.
|
Function
|
calc_all_cycle_positions
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void calc_all_cycle_positions( void )
|
Remarks
|
Calculate all of the cycle positions for all the programmed cycle
definitions.
|
Function
|
calc_one_cycle_position
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void calc_one_cycle_position( CREC *cycle_rec )
|
Remarks
|
Calculate all the cycle positions for a single CREC cycle_rec.
|
Function
|
find_date_offset
|
Include file
|
ANAL_CYC.H
|
Prototype
|
static int find_date_offset( float target )
|
Remarks
|
Find the target_date in the dates[] array. Return either it's index or
-1 as not found.
|
Function
|
calc_blended_cycles
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void calc_blended_cycles( int blend_idx , int cycle_idx )
|
Remarks
|
Process cycle blend number - blend_idx against the current cycle
positions found at cycle_idx.
|
Function
|
output_pending_cycles
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void output_pending_cycles( void )
|
Remarks
|
Output the cycle position report.
|
Function
|
output_blend_structs
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void output_blend_structs( void )
|
Remarks
|
Output to the report a description of all cycle blends that were
programmed.
|
Function
|
output_one_blend_struct
|
Include file
|
ANAL_CYC.H
|
Prototype
|
static void output_one_blend_struct( int blend_idx )
|
Remarks
|
Output a single cycle blend description.
|
Function
|
output_data_4_metastock
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void output_data_4_metastock( void )
|
Remarks
|
This is a hack to dump some data for importation into Metastock. I have
left this in to show how to do it.
|
Function
|
do_fibonacci_crossref
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void do_fibonacci_crossref( void )
|
Remarks
|
Load the data to cross-reference the Fibonacci time projections and the
high / low market extremes generated by FIB_RPT to the cycle positions.
What we need to do is read the ASCII text report generated by FIB_RPT,
watch for various keywords in the report and process their data when found.
Needless to say this code will only work if you buy FIB_RPT (or at-least
it's demo). I left this code in also as an example (not a sales pitch).
This code is controlled by the /F command line switch so ANAL_CYC will
run fine without FIB_RPT.
|
Function
|
process_fib_rpt_line
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void process_fib_rpt_line( char *data_line )
|
Remarks
|
Called by ld_ascii_data_file to process an individual report line from
a FIB_RPT run.
|
Function
|
store_a_fib_projection
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void store_a_fib_projection( int type , float date )
|
Remarks
|
Store a Fibonacci time projection.
|
Function
|
store_a_fib_node
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void store_a_fib_node( int type , float date )
|
Remarks
|
Mark a day as a short-term market high/low node.
|
Function
|
blank_pad_2_length
|
Include file
|
ANAL_CYC.H
|
Prototype
|
void blank_pad_2_length( char *str , int length )
|
Remarks
|
Pad the caller's string to the request length with spaces.
|
Table of Contents
Function Index
app_mon.c - a simple application monitor program
This is a simple example program used to monitor multiple program's output
or general health across your LAN. This program works by monitoring udp
tranmissions from the watched target programs. The way is it currently
configured I use it to monitor data flow on my lan generated by 2 real-time
data collection packages during market hours. And I monitor my unix server
24 hours / day. When some-one goes quiet for more than 90 seconds I
update the screen display to crashed and repeat a siren alarm every 60
seconds.
Function
|
WinMain
|
Include file
|
APP_MON.H
|
Prototype
|
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow )
|
Remarks
|
This is the main entry point for app_mon.
|
Function
|
process_cmd_line_4_arguments
|
Include file
|
APP_MON.H
|
Prototype
|
void process_cmd_line_4_arguments( LPSTR lpCmdLine )
|
Remarks
|
Process the user's command line arguments into a argv array which then is
processed by the normal getargs() procedure to store the data into the
programs switch flags.
|
Function
|
WndProc
|
Include file
|
APP_MON.H
|
Prototype
|
long CALLBACK WndProc( HWND hWnd , UINT mesg , UINT wParam , LONG lParam )
|
Remarks
|
This is a simple win proc for supporting the app_mon program. The only
important thing done here is hanging a timer tick routine to support
the checking the status of the monitored UDP ports. This is not the
displaying window - the display is a dialog box.
|
Function
|
cnvt_2_seconds_past_midnight
|
Include file
|
APP_MON.H
|
Prototype
|
int cnvt_2_seconds_past_midnight( char *time_str )
|
Remarks
|
Convert a HH:MM:SS time string into a integer value of total
seconds since midnight.
|
Function
|
timer_tick
|
Include file
|
APP_MON.H
|
Prototype
|
void timer_tick( void )
|
Remarks
|
This the main worker routine for app_mon. This routine controls the
start-up of the port monitoring, the actual checking of all the
monitored ports and the display update with the current program
states.
|
Function
|
main_dialog_func
|
Include file
|
APP_MON.H
|
Prototype
|
long CALLBACK main_dialog_func(
HWND hWnd , UINT mesg , UINT wParam , LONG lParam )
|
Remarks
|
The is the main user interface object - a modal dialog box. The only
functions that are supported are - resetting the display counts and status
and exit the app.
|
Function
|
load_dialog_data
|
Include file
|
APP_MON.H
|
Prototype
|
void load_dialog_data( HWND hWnd )
|
Remarks
|
Load the user interface dialog box with the current monitored appilcation
names, counts and status.
|
Function
|
init_app_recs_channels
|
Include file
|
APP_MON.H
|
Prototype
|
void init_app_recs_channels( void )
|
Remarks
|
This routine handles allocating and opening all the monitored udp
ports.
|
Function
|
reset_app_recs
|
Include file
|
APP_MON.H
|
Prototype
|
void reset_app_recs( void )
|
Remarks
|
Turn off all alarms and clear all counters for all the monitored
applications.
|
Function
|
chk_the_ports
|
Include file
|
APP_MON.H
|
Prototype
|
void chk_the_ports( void )
|
Remarks
|
This routine does the actual work of monitoring each application.
It checks each port for current udp traffic or checks how long it
has been since it heard something. If it has been too long it sets
the crashed alarm and plays the crashed alarm wav file. If traffic is
seen it just updates the counts and continues on.
|
Function
|
chk_rpt_tun_port
|
Include file
|
APP_MON.H
|
Prototype
|
void chk_rpt_tun_port( void )
|
Remarks
|
This is a special port that I monitor from my unix system 24 hours
per day unlike the other ports that I monitor just during the trading
session (since they are carrying market data). This port is actually
monitoring the state of my ppp connection.
|
Function
|
PlayResource
|
Include file
|
APP_MON.H
|
Prototype
|
BOOL PlayResource( HINSTANCE hInstance , char *pszSound )
|
Remarks
|
This routine will load a wav file resource from an application's
image file into memory and play it.
|
Table of Contents
Function Index
bin_tree.c - BINary TREE routines
Some simple handy-dandy binary tree routines.
Function
|
add_btree_node
|
Include file
|
BIN_TREE.H
|
Prototype
|
LPBTREE add_btree_node( char *key_str , void *data , int data_size )
|
Remarks
|
Allocate and initialize a binary tree node. If data_size != 0 then allocate
a buffer and copy the void *data_ptr into it. And the new node for linking
into the tree.
|
Function
|
add_2_binary_tree
|
Include file
|
BIN_TREE.H
|
Prototype
|
LPBTREE add_2_binary_tree( LPBTREE node , char *key_str , void *data , int data_size )
|
Remarks
|
Add a void *data structure into a binary tree - keyed off of key_str.
|
Function
|
add_ptr_2_binary_tree
|
Include file
|
BIN_TREE.H
|
Prototype
|
LPBTREE add_ptr_2_binary_tree( LPBTREE node , char *key_str , void *data )
|
Remarks
|
Add a new node into a binary tree - keyed off of key_str. And hook the
passed in ptr on to the node.
|
Function
|
find_btree_node
|
Include file
|
BIN_TREE.H
|
Prototype
|
LPBTREE find_btree_node( LPBTREE node , char *key_str )
|
Remarks
|
Find and return the btree node for key_str.
|
Function
|
print_btree_node
|
Include file
|
BIN_TREE.H
|
Prototype
|
void print_btree_node( LPBTREE node )
|
Remarks
|
A simple debug print routine. Suitable for calling from walk_binary_tree().
|
Function
|
walk_binary_tree
|
Include file
|
BIN_TREE.H
|
Prototype
|
void walk_binary_tree( LPBTREE node , FPTR process_routine )
|
Remarks
|
Visit all nodes of a binary tree and call the process_routine with each one.
|
Table of Contents
Function Index
blkboard.c - BLacK BOARD
This is a nice dual purpose program. It's main function is a udp
addressable display screen suitable for black-board message display
from another app (either machine local or lan wide). The secondary
function is being a nice example program for some of the capabilities
of the QS_WIN (Quote Screen Windows) routines.
Function
|
WinMain
|
Include file
|
BLKBOARD.H
|
Prototype
|
int WINAPI WinMain( HINSTANCE hInstance , HINSTANCE hPrevInstance ,
LPSTR lpCmdLine , int nCmdShow )
|
Remarks
|
This is the main program entry point for blkboard.c
|
Function
|
update_library_global_vars
|
Include file
|
BLKBOARD.H
|
Prototype
|
void update_library_global_vars( void )
|
Remarks
|
Update the TDF_lib global vars with data from the user's command line.
|
Function
|
print_usage_blkboard
|
Include file
|
BLKBOARD.H
|
Prototype
|
void print_usage_blkboard( void )
|
Remarks
|
Print a usage message for the user.
|
Function
|
process_cmd_line_4_arguments
|
Include file
|
BLKBOARD.H
|
Prototype
|
void process_cmd_line_4_arguments( void )
|
Remarks
|
Process the user's command line arguments into a argv array which then is
processed by the normal getargs() procedure to store the data into the
programs switch flags.
|
Function
|
localQSWndProc
|
Include file
|
BLKBOARD.H
|
Prototype
|
LONG WINAPI localQSWndProc(
HWND hWnd , UINT messg , UINT wParam , LONG lParam )
|
Remarks
|
This is the program local QSWndProc. It is used mainly to support
exiting from the app via the keyboard.
|
Function
|
udp_thread
|
Include file
|
BLKBOARD.H
|
Prototype
|
void udp_thread( PVOID pvoid )
|
Remarks
|
This thread supports the udp message port. It opens the listening port
and then hangs in a while( TRUE ) loop on a udp blocked read
processing incoming display message data.
|
Function
|
log_msg_to_scr
|
Include file
|
BLKBOARD.H
|
Prototype
|
void log_msg_to_scr( char *msg )
|
Remarks
|
This routine updates the debug message line of the screen display interface
list with the new message data.
|
Function
|
process_udp_msg
|
Include file
|
BLKBOARD.H
|
Prototype
|
void process_udp_msg( char *msg )
|
Remarks
|
This routine breaks up the incoming udp message into either screen display
data messages or active screen command messages.
msg - "DP1,R4,C7,X2,the actual msg
msg - "Data_msgPage_num,Row_num,Column_num,X(color)_num,the actual msg
|
Function
|
process_data_msg
|
Include file
|
BLKBOARD.H
|
Prototype
|
void process_data_msg( char *msg )
|
Remarks
|
This routine takes the screen display data messages, parses out the
page, row, column and color data from the data message. It then
updates the screen display interface list at the requested row & column
with the new message data. It also does a color flash it included in the
message.
|
Function
|
process_active_msg
|
Include file
|
BLKBOARD.H
|
Prototype
|
void process_active_msg( char *msg )
|
Remarks
|
This is a simple routine to process active screen control messages. Just
2 are currently supported. R - resets the page and X allows you to change
the default color for a qs_win field.
|
Function
|
str_2_buffer
|
Include file
|
BLKBOARD.H
|
Prototype
|
void str_2_buffer( char *dest , int col , char *src )
|
Remarks
|
Move a string to a given row and column in the display buffers.
|
Function
|
reset_page_1
|
Include file
|
BLKBOARD.H
|
Prototype
|
void reset_page_1( void )
|
Remarks
|
A simple reset page function.
|
Table of Contents
Function Index
cirbuf_r.c - CIRcular BUFfer Routines.
A collection of routines to build and support a circular byte buffer.
Suitable for storing and buffering a data stream from a device like
a serial port. Or you can buffer display characters to a tty style window.
Function
|
alloc_circular_buff
|
Include file
|
CIRBUF_R.H
|
Prototype
|
CBUF * alloc_circular_buff( int size )
|
Remarks
|
Allocate, initialize and return a virgin circular buffer structure.
|
Function
|
init_circular_buff
|
Include file
|
CIRBUF_R.H
|
Prototype
|
void init_circular_buff( CBUF *cb_ptr )
|
Remarks
|
Reset the data pointers of the circular buffer.
|
Function
|
free_circular_buff
|
Include file
|
CIRBUF_R.H
|
Prototype
|
void free_circular_buff( CBUF *cb_ptr )
|
Remarks
|
Free a circular buffer structure.
|
Function
|
reset_read_circular_buff
|
Include file
|
CIRBUF_R.H
|
Prototype
|
void reset_read_circular_buff( CBUF *cb_ptr )
|
Remarks
|
Reset the temporary read pointer back to the tail.
|
Function
|
store_in_circular_buff
|
Include file
|
CIRBUF_R.H
|
Prototype
|
void store_in_circular_buff( CBUF *cb_ptr , char *str )
|
Remarks
|
Copy a data string into the circular buffer.
|
Function
|
set_lines_array
|
Include file
|
CIRBUF_R.H
|
Prototype
|
void set_lines_array( CBUF *cb_ptr )
|
Remarks
|
Sweep the circular buffer and set the line ptr array.
|
Function
|
get_next_from_circular_buff
|
Include file
|
CIRBUF_R.H
|
Prototype
|
char get_next_from_circular_buff( CBUF *cb_ptr )
|
Remarks
|
Return the next data value from the circular buffer and advance the
buffer pointers.
|
Table of Contents
Function Index
CSTM_IND.C - CuSToM INDicator routines
This module contains the indicator routines for Indicator Engine. 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( IE_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
|
IE_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( IE_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( IE_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
|
IE_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( IE_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 IE_MACD (Moving Average Convergence /
Divergence ) indicator structure.
|
Function
|
alloc_macd
|
Include file
|
CSTM_IND.H
|
Prototype
|
IE_MACD * alloc_macd( int ma_length1 , int ma_length2 , int trigger )
|
Remarks
|
Allocate a new IE_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 IE_MACD indicator structure and attach it to the cur_prc_rec.
|
Function
|
ie_calc_emacd
|
Include file
|
CSTM_IND.H
|
Prototype
|
void ie_calc_emacd( IE_MACD *macd_ptr , float data )
|
Remarks
|
Calculate a new output value for the given exponential IE_MACD indicator
structure using the provided data.
|
Function
|
ie_calc_smacd
|
Include file
|
CSTM_IND.H
|
Prototype
|
void ie_calc_smacd( IE_MACD *macd_ptr , float data )
|
Remarks
|
Calculate a new output value for the given simple IE_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 IE_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
|
ie_calc_range
|
Include file
|
CSTM_IND.H
|
Prototype
|
void ie_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
|
IE_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( IE_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( IE_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
|
IE_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( IE_STDDEV *stddev_ptr )
|
Remarks
|
Initialize the given standard deviation indicator structure.
|
Function
|
update_stddev
|
Include file
|
CSTM_IND.H
|
Prototype
|
void update_stddev( IE_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.
|
Function
|
init_daytype
|
Include file
|
CSTM_IND.H
|
Prototype
|
void init_daytype( void )
|
Remarks
|
Initialize the cur_prc_rec's day type analysis indicator structure.
|
Function
|
allocate_daytype
|
Include file
|
CSTM_IND.H
|
Prototype
|
void allocate_daytype( void )
|
Remarks
|
Allocate a day type analysis indicator structure and attach it to the
cur_prc_rec.
|
Function
|
calc_daytype
|
Include file
|
CSTM_IND.H
|
Prototype
|
void calc_daytype( void )
|
Remarks
|
Calculate the current output value for the day type analysis indicator
attached to the cur_prc_rec.
|
Function
|
final_day_type_analyze
|
Include file
|
CSTM_IND.H
|
Prototype
|
void final_day_type_analyze( void )
|
Remarks
|
This is a post process routine used for a final day type analysis.
|
Function
|
alloc_wuo
|
Include file
|
CSTM_IND.H
|
Prototype
|
IE_WUO * alloc_wuo( void )
|
Remarks
|
Allocate, initialize and return a Williams' Ultimate Oscillator indicator
structure. All 3 time periods are per Larry Williams' specs.
|
Function
|
calc_ultimate_osc_value
|
Include file
|
CSTM_IND.H
|
Prototype
|
float calc_ultimate_osc_value( IE_WUO *wuo_ptr )
|
Remarks
|
Calculate the current value for the given Williams' Ultimate Oscillator
indicator structure.
|
Function
|
init_wuo
|
Include file
|
CSTM_IND.H
|
Prototype
|
void init_wuo( void )
|
Remarks
|
Initialize the cur_prc_rec's Williams' Ultimate Oscillator indicator structure.
|
Function
|
allocate_wuo
|
Include file
|
CSTM_IND.H
|
Prototype
|
void allocate_wuo( void )
|
Remarks
|
Allocate a Williams' Ultimate Oscillator indicator structure and attach
it to the cur_prc_rec.
|
Function
|
calc_wuo
|
Include file
|
CSTM_IND.H
|
Prototype
|
void calc_wuo( void )
|
Remarks
|
Calculate the current output value for the Williams' Ultimate Oscillator
indicator attached to the cur_prc_rec.
|
Function
|
init_chaikin
|
Include file
|
CSTM_IND.H
|
Prototype
|
void init_chaikin( void )
|
Remarks
|
Initialize the cur_prc_rec's Chaikin's volume indicator structure.
|
Function
|
allocate_chaikin
|
Include file
|
CSTM_IND.H
|
Prototype
|
void allocate_chaikin( void )
|
Remarks
|
Allocate a Chaikin's volume indicator structure and attach it to the
cur_prc_rec.
|
Function
|
calc_chaikin
|
Include file
|
CSTM_IND.H
|
Prototype
|
void calc_chaikin( void )
|
Remarks
|
Calculate the current output value for the Chaikin's volume indicator
attached to the cur_prc_rec.
|
Function
|
allocate_pivot_pts
|
Include file
|
CSTM_IND.H
|
Prototype
|
void allocate_pivot_pts( void )
|
Remarks
|
Allocate a pivot point indicator structure and attach it to the cur_prc_rec.
|
Function
|
calc_pivot_pts
|
Include file
|
CSTM_IND.H
|
Prototype
|
void calc_pivot_pts( void )
|
Remarks
|
Calculate the current output value for the pivot point indicator attached
to the cur_prc_rec.
|
Function
|
update_wld_ma_ptr
|
Include file
|
CSTM_IND.H
|
Prototype
|
void update_wld_ma_ptr( IE_WLD_MA *wld_ma_ptr , float data )
|
Remarks
|
Update the given Wilder's Moving Average indicator structure with the new
data.
|
Function
|
init_wld_ma_ptr
|
Include file
|
CSTM_IND.H
|
Prototype
|
void init_wld_ma_ptr( IE_WLD_MA *wld_ma_ptr )
|
Remarks
|
Initialize the cur_prc_rec's Wilder's Moving Average indicator structure.
|
Function
|
alloc_wld_ma
|
Include file
|
CSTM_IND.H
|
Prototype
|
IE_WLD_MA * alloc_wld_ma( int ma_length , int sum_or_avg )
|
Remarks
|
Allocate a Wilder's Moving Average indicator structure and attach it to
the cur_prc_rec.
|
Function
|
init_dmi
|
Include file
|
CSTM_IND.H
|
Prototype
|
void init_dmi( void )
|
Remarks
|
Initialize the cur_prc_rec's Wilder's Directional Movement indicator
structure.
|
Function
|
allocate_dmi
|
Include file
|
CSTM_IND.H
|
Prototype
|
void allocate_dmi( void )
|
Remarks
|
Allocate a Wilder's Directional Movement indicator structure and attach
it to the cur_prc_rec.
|
Function
|
calc_dmi
|
Include file
|
CSTM_IND.H
|
Prototype
|
void calc_dmi( void )
|
Remarks
|
Calculate the current output value for the Wilder's Directional Movement
indicator attached to the cur_prc_rec.
|
Function
|
init_par
|
Include file
|
CSTM_IND.H
|
Prototype
|
void init_par( void )
|
Remarks
|
Initialize the cur_prc_rec's Wilder's parabolic stop and reverse indicator
structure.
|
Function
|
allocate_par
|
Include file
|
CSTM_IND.H
|
Prototype
|
void allocate_par( void )
|
Remarks
|
Allocate a Wilder's parabolic stop and reverse indicator structure and
attach it to the cur_prc_rec.
|
Function
|
calc_par
|
Include file
|
CSTM_IND.H
|
Prototype
|
void calc_par( void )
|
Remarks
|
Calculate the current output value for the Wilder's parabolic stop and
reverse indicator attached to the cur_prc_rec.
|
Function
|
init_obv
|
Include file
|
CSTM_IND.H
|
Prototype
|
void init_obv( void )
|
Remarks
|
Initialize the cur_prc_rec's Granville's On Balance Volume indicator
structure.
|
Function
|
allocate_obv
|
Include file
|
CSTM_IND.H
|
Prototype
|
void allocate_obv( void )
|
Remarks
|
Allocate a Granville's On Balance Volume indicator structure and attach
it to the cur_prc_rec.
|
Function
|
calc_obv
|
Include file
|
CSTM_IND.H
|
Prototype
|
void calc_obv( void )
|
Remarks
|
Calculate the current output value for the Granville's On Balance Volume
indicator attached to the cur_prc_rec.
|
Function
|
init_nvi
|
Include file
|
CSTM_IND.H
|
Prototype
|
void init_nvi( void )
|
Remarks
|
Initialize the cur_prc_rec's Negative Volume Index indicator structure.
|
Function
|
allocate_nvi
|
Include file
|
CSTM_IND.H
|
Prototype
|
void allocate_nvi( void )
|
Remarks
|
Allocate a Negative Volume Index indicator structure and attach it to
the cur_prc_rec.
|
Function
|
calc_nvi
|
Include file
|
CSTM_IND.H
|
Prototype
|
void calc_nvi( void )
|
Remarks
|
Calculate the current output value for the Negative Volume Index indicator
attached to the cur_prc_rec.
|
Function
|
init_pvi
|
Include file
|
CSTM_IND.H
|
Prototype
|
void init_pvi( void )
|
Remarks
|
Initialize the cur_prc_rec's Positive Volume Index indicator structure.
|
Function
|
allocate_pvi
|
Include file
|
CSTM_IND.H
|
Prototype
|
void allocate_pvi( void )
|
Remarks
|
Allocate a Positive Volume Index indicator structure and attach it to
the cur_prc_rec.
|
Function
|
calc_pvi
|
Include file
|
CSTM_IND.H
|
Prototype
|
void calc_pvi( void )
|
Remarks
|
Calculate the current output value for the Positive Volume Index indicator
attached to the cur_prc_rec.
|
Function
|
ie_calc_linreg
|
Include file
|
CSTM_IND.H
|
Prototype
|
void ie_calc_linreg( IE_LINREG *linreg , int data_max , float *data )
|
Remarks
|
Calculate and update the given linear regression indicator structure
for the data series provided.
|
Function
|
init_tslr
|
Include file
|
CSTM_IND.H
|
Prototype
|
void init_tslr( void )
|
Remarks
|
Initialize the cur_prc_rec's Time Series Linear Regression indicator
structure.
|
Function
|
allocate_tslr
|
Include file
|
CSTM_IND.H
|
Prototype
|
void allocate_tslr( void )
|
Remarks
|
Allocate a Time Series Linear Regression indicator structure and attach
it to the cur_prc_rec.
|
Function
|
calc_tslr
|
Include file
|
CSTM_IND.H
|
Prototype
|
void calc_tslr( void )
|
Remarks
|
Calculate the current output value for the Time Series Linear Regression
indicator attached to the cur_prc_rec.
|
Function
|
init_ad
|
Include file
|
CSTM_IND.H
|
Prototype
|
void init_ad( void )
|
Remarks
|
Initialize the cur_prc_rec's Accumulation / Distribution indicator
structure.
|
Function
|
allocate_ad
|
Include file
|
CSTM_IND.H
|
Prototype
|
void allocate_ad( void )
|
Remarks
|
Allocate a Accumulation / Distribution indicator structure and attach it
to the cur_prc_rec.
|
Function
|
calc_ad
|
Include file
|
CSTM_IND.H
|
Prototype
|
void calc_ad( void )
|
Remarks
|
Calculate the current output value for the Accumulation / Distribution
indicator attached to the cur_prc_rec.
|
Function
|
set_data_labels_complex
|
Include file
|
CSTM_IND.H
|
Prototype
|
void set_data_labels_complex( MATHOP *mathop_ptr )
|
Remarks
|
This is a specialized subset version of set_data_source_n_labels() to
build output labels for math operation processes.
|
Function
|
set_data_source_complex
|
Include file
|
CSTM_IND.H
|
Prototype
|
void set_data_source_complex( int *src_type , int *src_idx , float *src_constant )
|
Remarks
|
This is a specialized subset version of set_data_source_n_labels() to
set the data sources for math operation processes.
|
Function
|
init_mathop
|
Include file
|
CSTM_IND.H
|
Prototype
|
void init_mathop( void )
|
Remarks
|
Initialize the cur_prc_rec's math operation indicator structure.
|
Function
|
allocate_mathop
|
Include file
|
CSTM_IND.H
|
Prototype
|
void allocate_mathop( void )
|
Remarks
|
Allocate a math operation indicator structure and attach it to the
cur_prc_rec.
|
Function
|
calc_mathop
|
Include file
|
CSTM_IND.H
|
Prototype
|
void calc_mathop( void )
|
Remarks
|
Calculate the current output value for the math operation indicator
attached to the cur_prc_rec.
|
Function
|
allocate_srat
|
Include file
|
CSTM_IND.H
|
Prototype
|
void allocate_srat( void )
|
Remarks
|
Allocate a signed ratio indicator structure and attach it to the
cur_prc_rec.
|
Function
|
calc_srat
|
Include file
|
CSTM_IND.H
|
Prototype
|
void calc_srat( void )
|
Remarks
|
Calculate the current output value for the signed ratio indicator
attached to the cur_prc_rec.
|
Function
|
init_trix
|
Include file
|
CSTM_IND.H
|
Prototype
|
void init_trix( void )
|
Remarks
|
Initialize the cur_prc_rec's IE_TRIX indicator structure.
|
Function
|
allocate_trix
|
Include file
|
CSTM_IND.H
|
Prototype
|
void allocate_trix( void )
|
Remarks
|
Allocate a IE_TRIX indicator structure and attach it to the cur_prc_rec.
|
Function
|
calc_trix
|
Include file
|
CSTM_IND.H
|
Prototype
|
void calc_trix( void )
|
Remarks
|
Calculate the current output value for the IE_TRIX indicator attached to
the cur_prc_rec.
|
Function
|
init_trix
|
Include file
|
CSTM_IND.H
|
Prototype
|
void init_trix( void )
|
Remarks
|
Initialize the cur_prc_rec's non-log IE_TRIX indicator structure.
|
Function
|
allocate_trix
|
Include file
|
CSTM_IND.H
|
Prototype
|
void allocate_trix( void )
|
Remarks
|
Allocate a non-log IE_TRIX indicator structure and attach it to
the cur_prc_rec.
|
Function
|
calc_trix
|
Include file
|
CSTM_IND.H
|
Prototype
|
void calc_trix( void )
|
Remarks
|
Calculate the current output value for the non-log IE_TRIX indicator attached
to the cur_prc_rec.
|
Function
|
allocate_thigh
|
Include file
|
CSTM_IND.H
|
Prototype
|
void allocate_thigh( void )
|
Remarks
|
Allocate a True High indicator structure and attach it to the cur_prc_rec.
|
Function
|
calc_thigh
|
Include file
|
CSTM_IND.H
|
Prototype
|
void calc_thigh( void )
|
Remarks
|
Calculate the current output value for the True High indicator attached
to the cur_prc_rec.
|
Function
|
allocate_tlow
|
Include file
|
CSTM_IND.H
|
Prototype
|
void allocate_tlow( void )
|
Remarks
|
Allocate a True Low indicator structure and attach it to the cur_prc_rec.
|
Function
|
calc_tlow
|
Include file
|
CSTM_IND.H
|
Prototype
|
void calc_tlow( void )
|
Remarks
|
Calculate the current output value for the True Low indicator attached
to the cur_prc_rec.
|
Function
|
allocate_max
|
Include file
|
CSTM_IND.H
|
Prototype
|
void allocate_max( void )
|
Remarks
|
Allocate a Max indicator structure and attach it to the cur_prc_rec.
|
Function
|
allocate_min
|
Include file
|
CSTM_IND.H
|
Prototype
|
void allocate_min( void )
|
Remarks
|
Allocate a Min indicator structure and attach it to the cur_prc_rec.
|
Function
|
init_rwi
|
Include file
|
CSTM_IND.H
|
Prototype
|
void init_rwi( void )
|
Remarks
|
Initialize the cur_prc_rec's random walk index indicator structure.
|
Function
|
allocate_rwi
|
Include file
|
CSTM_IND.H
|
Prototype
|
void allocate_rwi( void )
|
Remarks
|
Allocate a random walk index indicator structure and attach it to the
cur_prc_rec.
|
Function
|
calc_rwi
|
Include file
|
CSTM_IND.H
|
Prototype
|
void calc_rwi( void )
|
Remarks
|
Calculate the current output value for the random walk index indicator
attached to the cur_prc_rec.
|
Function
|
init_ama
|
Include file
|
CSTM_IND.H
|
Prototype
|
void init_ama( void )
|
Remarks
|
Initialize the cur_prc_rec's adaptive moving average indicator
structure.
|
Function
|
allocate_ama
|
Include file
|
CSTM_IND.H
|
Prototype
|
void allocate_ama( void )
|
Remarks
|
Allocate a adaptive moving average indicator structure and attach
it to the cur_prc_rec.
|
Function
|
calc_ama
|
Include file
|
CSTM_IND.H
|
Prototype
|
void calc_ama( void )
|
Remarks
|
Calculate the current output value for the adaptive moving average
indicator attached to the cur_prc_rec.
|
Function
|
init_wma
|
Include file
|
CSTM_IND.H
|
Prototype
|
void init_wma( void )
|
Remarks
|
Initialize the cur_prc_rec's weighted moving average indicator structure.
|
Function
|
allocate_wma
|
Include file
|
CSTM_IND.H
|
Prototype
|
void allocate_wma( void )
|
Remarks
|
Allocate a weighted moving average indicator structure and attach it to
the cur_prc_rec.
|
Function
|
calc_wma
|
Include file
|
CSTM_IND.H
|
Prototype
|
void calc_wma( void )
|
Remarks
|
Calculate the current output value for the weighted moving average indicator
attached to the cur_prc_rec.
|
Table of Contents
Function Index
dbm_port.c - DeBug Message PORT routines
These routines allow a Windows app to send debug messages out
transparently to its own operation. The messages are LAN
broadcasted via UDP. The code supports four classes of
debug messages and it is runtime configurable. If the
debug level == 0 then the routines will do nothing but
just return so this code can be left in final product code
and activated on the customer box for tech support problem
calls.
Warning about db_printf - it uses wvsprintf() which does not
support floats & doubles. So if you need to output a floating
point number you must first use sprintf to write it to a char
buffer then you can dump the str from db_printf (sorry - but don't
blame me - blame Bill and the boys).
Function
|
init_debug_port_subsystem
|
Include file
|
DBM_PORT.H
|
Prototype
|
void init_debug_port_subsystem(
int debug_flag , int debug_port_num )
|
Remarks
|
Init the subsystem default values that will be used for the automatic
port open.
|
Function
|
free_debug_port
|
Include file
|
DBM_PORT.H
|
Prototype
|
void free_debug_port( void )
|
Remarks
|
Force the debugg port closed and reset the global subsystem vars.
|
Function
|
open_debug_port
|
Include file
|
DBM_PORT.H
|
Prototype
|
void open_debug_port( void )
|
Remarks
|
Allocate and open a udp port to write the debug output to.
|
Function
|
db_printf
|
Include file
|
DBM_PORT.H
|
Prototype
|
void db_printf( int req_debug_level , const char *szFormat , ... )
|
Remarks
|
db_printf is a printf that outputs to a udp port if the requested debug level
is set in the current debug_level. It will also handle the opening of the udp
port if necessary.
|
Table of Contents
Function Index
fontnclr.c - FONTs aNd CoLoRs
This module's routines will create a HFONT handle for any
font installed on your system suitable for used by any of the
TDF_lib library defined window classes. It also defines a standard
color set of RGB() values.
Function
|
Portions
|
Include file
|
FONTNCLR.H
|
Prototype
|
Portions (c) Charles Petzold, 1996
|
Remarks
|
these 13 fonts are part of the standard install of Win95 & WinNT
add new fonts below here V
|
Function
|
EzCreateFont
|
Include file
|
FONTNCLR.H
|
Prototype
|
HFONT EzCreateFont( HDC hdc , char *szFaceName , int iDeciPtHeight ,
int iDeciPtWidth , int iAttributes , BOOL fLogRes ) ;
|
Remarks
|
|
Function
|
super_ez_create_font
|
Include file
|
FONTNCLR.H
|
Prototype
|
HFONT super_ez_create_font( HDC hdc , int font_value )
|
Remarks
|
Create and return a HFONT for any font installed on your system.
|
Function
|
EzCreateFont
|
Include file
|
FONTNCLR.H
|
Prototype
|
HFONT EzCreateFont( HDC hdc, char * szFaceName, int iDeciPtHeight,
int iDeciPtWidth, int iAttributes, BOOL fLogRes )
|
Remarks
|
Allocate, initialize and return a HFONT.
|
Table of Contents
Function Index
grx_test.c -
This is a simple testbed that I used to first develop the graphic
window routines. I have included it as a sample program since it shows
examples of a number of low level calls into the G_WIN subsystem and
direct window handling. High level examples can be found in SNAPSHOT.C.
This is NOT a finished or polished app (but just a QND hack :-)
Function
|
pack
|
Include file
|
GRX_TEST.H
|
Prototype
|
#pragma pack( 4 )
|
Remarks
|
|
Function
|
WinMain
|
Include file
|
GRX_TEST.H
|
Prototype
|
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow )
|
Remarks
|
Main entry.
|
Function
|
process_cmd_line_4_arguments
|
Include file
|
GRX_TEST.H
|
Prototype
|
void process_cmd_line_4_arguments( LPSTR lpCmdLine )
|
Remarks
|
Process the user's command line arguments into a argv array which then is
processed by the normal getargs() procedure to store the data into the
programs switch flags.
|
Function
|
localGWndProc
|
Include file
|
GRX_TEST.H
|
Prototype
|
LONG WINAPI localGWndProc(
HWND hWnd , UINT messg , UINT wParam , LONG lParam )
|
Remarks
|
This is the local G_WIN WinProc. It just handles keyboard input to
honor exit requests.
|
Function
|
test_routine1
|
Include file
|
GRX_TEST.H
|
Prototype
|
void test_routine1( G_WIN *w_ptr )
|
Remarks
|
|
Function
|
control_c_handler
|
Include file
|
GRX_TEST.H
|
Prototype
|
BOOL WINAPI control_c_handler( DWORD dwCtrlType )
|
Remarks
|
A simple windows control-c catcher. It currently doesn't do much -
just signal the event out the DB msg port.
|
Function
|
calc_cycle_position
|
Include file
|
GRX_TEST.H
|
Prototype
|
float calc_cycle_position( int cycle_length , int cur_offset )
|
Remarks
|
Calculate the current position in a cycle, return x where 1 >= x >= -1
with 1 = top of the cycle & -1 = bottom of the cycle.
|
Table of Contents
Function Index
g_win_r.c - Graphics WINdow Routines
This is the graphics windows subsystem. It supports plotting of a
DATA_REC data series as either HLC or OHLC bar charts with volume
bars and overlayed open interest plots. Or you can display candlestick
or equivolume charts. You can also overlay indicator plots on the
data chart. You also have complete control in plotting indicator
charts. You can plot histograms. Scaling is automatic or you can set
it manually. You can overlay as many items on a chart as you wish.
You have complete control over all plotting pens - they can be any of
16,777,216 colors, any width or plotting style. You also build
multi-chart windows with as many G_WIN inside a frame window as you
want. You can also use any TrueType font installed on your system.
You can also save any window to disk as a BMP file.
From a high level view a G_WIN is constructed by these data structures.
A single G_WIN struct controls the window construction information like
client sizes, data cnts, titles and WIN32 objects like brushes, dc's,
window handles and bitmaps. It then has 1 to N number of GDDS (Graphics
Display Data Series) records attached to it take provide the actual data
to be graphed and control the actual style of display.
Function
|
init_grfx_subsystem
|
Include file
|
G_WIN_R.H
|
Prototype
|
void init_grfx_subsystem( void )
|
Remarks
|
Allocate all the pens and the background brush for the grfx_subsystem.
|
Function
|
free_grfx_subsystem
|
Include file
|
G_WIN_R.H
|
Prototype
|
void free_grfx_subsystem( void )
|
Remarks
|
Do a DeleteObject() on all the pens of the subsystem.
|
Function
|
alloc_G_WIN
|
Include file
|
G_WIN_R.H
|
Prototype
|
G_WIN * alloc_G_WIN( void )
|
Remarks
|
Allocate and initialize a G_WIN struct. This routine will also call
init_grfx_subsystem to create the plotting pens.
|
Function
|
regGWINClass
|
Include file
|
G_WIN_R.H
|
Prototype
|
ATOM regGWINClass( G_WIN *gw_ptr )
|
Remarks
|
Register the G_WIN class with WIN32.
|
Function
|
GrfxWndProc
|
Include file
|
G_WIN_R.H
|
Prototype
|
GrfxWndProc( HWND hWnd , UINT mesg , UINT wParam , LONG lParam )
|
Remarks
|
This is the main WndProc for the graphics subsystem.
|
Function
|
create_g_window
|
Include file
|
G_WIN_R.H
|
Prototype
|
HWND create_g_window( G_WIN *gw_ptr , LPSTR window_title )
|
Remarks
|
Take the user initialized G_WIN ptr and create an actual window.
|
Function
|
free_g_window
|
Include file
|
G_WIN_R.H
|
Prototype
|
void free_g_window( G_WIN *gw_ptr )
|
Remarks
|
Free the memory of a G_WIN and all of its GDDS data items.
|
Function
|
clear_g_window
|
Include file
|
G_WIN_R.H
|
Prototype
|
void clear_g_window( G_WIN *gw_ptr )
|
Remarks
|
Use the background brush to clear a G_WIN.
|
Function
|
set_favorite_g_win_config
|
Include file
|
G_WIN_R.H
|
Prototype
|
void set_favorite_g_win_config( G_WIN *gw_ptr )
|
Remarks
|
Set the passed in G_WIN ptr to the current module defaults.
|
Function
|
set_g_win_defaults
|
Include file
|
G_WIN_R.H
|
Prototype
|
void set_g_win_defaults( int width , int height , int font )
|
Remarks
|
Set the module defaults for G_WINs.
|
Function
|
set_pen_defaults
|
Include file
|
G_WIN_R.H
|
Prototype
|
void set_pen_defaults( int pen_idx , int pen_style , int pen_width , COLORREF pen_color )
|
Remarks
|
Use this routine to modify the module defaults for the plotting pen array.
This routine must be called before init_grfx_subsystem() is called to create
the pens. The pen_idx is a enum value of type DF_PEN (defined in G_WIN_R.H).
The argument pen_style can be any valid windows PS constant and the pen_color
can be any RGB() value.
|
Function
|
create_gdds_data_rec
|
Include file
|
G_WIN_R.H
|
Prototype
|
GDDS * create_gdds_data_rec( int max_nodes , int node_cnt , DATA_REC *data )
|
Remarks
|
Allocate, initialize and return a new GDDS record for a DATA_REC data series.
The resulting GDDS record will cache its own copy of the data series of
max_nodes size. The data series will also be scanned and the max_dt_val &
min_dt_val set.
|
Function
|
insert_gdds_item
|
Include file
|
G_WIN_R.H
|
Prototype
|
void insert_gdds_item( G_WIN *gw_ptr , GDDS *gdds_ptr )
|
Remarks
|
Walk the list of GDDS records attached to a G_WIN ptr and hook the
passed in gdds_ptr to the end. And of course update the ptrs in the
gw_ptr. Also copy the gw_ptr->cht_flags into the gdds_ptr->cht_flags
if this is the first GDDS record in the chain since the fist record
controls scaling and display style.
|
Function
|
free_gdds_rec
|
Include file
|
G_WIN_R.H
|
Prototype
|
void free_gdds_rec( GDDS *gdds_ptr )
|
Remarks
|
Free the target GDDS record and any data series attached to it.
|
Function
|
create_gdds_ind
|
Include file
|
G_WIN_R.H
|
Prototype
|
GDDS * create_gdds_ind( int max_nodes , int node_cnt , float *data , HPEN draw_pen )
|
Remarks
|
Allocate, initialize and return a new GDDS record for a indicator data series.
The resulting GDDS record will cache its own copy of the data series of
max_nodes size. The data series will also be scanned and the max_dt_val &
min_dt_val set.
|
Function
|
create_gdds_horz_line
|
Include file
|
G_WIN_R.H
|
Prototype
|
GDDS * create_gdds_horz_line( float y_value , HPEN line_color )
|
Remarks
|
Allocate, initialize and return a new GDDS record for a horizontal line at
location - y_value draw with a pen color of - line_color.
|
Function
|
attach_data_rec_series
|
Include file
|
G_WIN_R.H
|
Prototype
|
void attach_data_rec_series( GDDS *gdds_ind_ptr , int max_nodes ,
int node_cnt , DATA_REC *data )
|
Remarks
|
Clone a DATA_REC data series and attached it to a given indicator data series
so that the date field in the DATA_REC can be used to label the x-axis.
|
Function
|
render_gdds_chain
|
Include file
|
G_WIN_R.H
|
Prototype
|
void render_gdds_chain( G_WIN *gw_ptr )
|
Remarks
|
This routine controls the rendering of all the attached GDDS records for a
given G_WIN. It also creates and destroys any user custom fonts and hits
the InvalidateRect() to cause Windows to generate a WM_PAINT msg so the
WndProc can copy the virtual bitmap to the users screen.
|
Function
|
render_gdds_data_rec
|
Include file
|
G_WIN_R.H
|
Prototype
|
void render_gdds_data_rec( G_WIN *gw_ptr , GDDS *gdds_ptr )
|
Remarks
|
This is the main drawing routine for the GDDS record of a DATA_REC data series.
This routine will set the plotting for the various chart types (like HLC bar vers
OHLC, candlestick, equivolume, overlays of volume and open interest) by checking
the cht_flags var and the DATA_REC open, volume, and open interest fields. It
will also calculate the scaling factors if the user has not set the manual scaling
vars. And of course last but not least - it will then draw the chart.
|
Function
|
render_gdds_ind
|
Include file
|
G_WIN_R.H
|
Prototype
|
void render_gdds_ind( G_WIN *gw_ptr , GDDS *gdds_ptr )
|
Remarks
|
This is the main drawing routine for the GDDS record of a indicator data series.
Plotting a float series is a little simpler - the only plot options are line
or histogram. If the GDDS record is the first in the chain - it will control
the window scaling else it is just overlayed on to the chart. This routine
will also label the x-axis with the date if a DATA_REC data series has been
provided.
G_WIN *lc_gw_ptr ;
lc_gw_ptr = ( G_WIN * ) gdds_ptr->gw_ptr ;
|
Function
|
render_gdds_horz_line
|
Include file
|
G_WIN_R.H
|
Prototype
|
void render_gdds_horz_line( G_WIN *gw_ptr , GDDS *gdds_ptr )
|
Remarks
|
Rendering this GDDS object is pretty simple - just draw_y_line.
|
Function
|
update_gdds_client_area
|
Include file
|
G_WIN_R.H
|
Prototype
|
void update_gdds_client_area( G_WIN *gw_ptr , GDDS *gdds_ptr )
|
Remarks
|
Update the plotting area size vars in the GDDS record by checking the actual
sizes in the G_WIN ptr (which automatically gets updated in the WndProc by
WM_SIZE msgs).
|
Function
|
check_gdds_data_range
|
Include file
|
G_WIN_R.H
|
Prototype
|
void check_gdds_data_range( GDDS *gdds_ptr )
|
Remarks
|
Make sure we have a useable range of y data. If the data range is
less than 1% - increase the actual min and max values by 5%.
|
Function
|
calc_dt_range
|
Include file
|
G_WIN_R.H
|
Prototype
|
void calc_dt_range( GDDS *gdds_ptr )
|
Remarks
|
Calculate the data range then calc the scaling increment and plot
scaling factor.
|
Function
|
set_high_lows
|
Include file
|
G_WIN_R.H
|
Prototype
|
void set_high_lows( GDDS *gdds_ptr , float *high_ptr , float *low_ptr , int loop_cnt )
|
Remarks
|
Find the highest_high and the lowest_low in the data series and store
them back into the caller's memory.
|
Function
|
calc_range
|
Include file
|
G_WIN_R.H
|
Prototype
|
void calc_range( GDDS *gdds_ptr , int interval_index , int loop_cnt )
|
Remarks
|
Find the best fit scale interval for the data series. This routine will
call itself recursively with loop_cnt in control of when to bail out.
|
Function
|
set_plot_range
|
Include file
|
G_WIN_R.H
|
Prototype
|
void set_plot_range( GDDS *gdds_ptr , float min_range , float max_range )
|
Remarks
|
Use this routine to force a chart to be plotted and scaled to your
specified min and max range values. This routine must be called before
the call to render_gdds_chain().
|
Function
|
round_as_int
|
Include file
|
G_WIN_R.H
|
Prototype
|
float round_as_int( float float_data , float interval , int fudge_factor )
|
Remarks
|
Convert a float to an integer, round it, then convert it back to a float
and return it.
|
Function
|
calc_dt_n_axis_scale_factors
|
Include file
|
G_WIN_R.H
|
Prototype
|
int calc_dt_n_axis_scale_factors( GDDS *gdds_ptr )
|
Remarks
|
Calculate the data range, plot scale factors and axis move increments.
Return TRUE if ok to plot else FALSE if not.
|
Function
|
build_axis_incs
|
Include file
|
G_WIN_R.H
|
Prototype
|
void build_axis_incs( GDDS *gdds_ptr )
|
Remarks
|
Calculate the axis plot increments based on number of data points and
number of scaling rows.
|
Function
|
set_x_inc
|
Include file
|
G_WIN_R.H
|
Prototype
|
void set_x_inc( int x_start , int x_stop , int num_of_cols )
|
Remarks
|
Calculate the x axis increment per data point.
|
Function
|
set_y_inc
|
Include file
|
G_WIN_R.H
|
Prototype
|
void set_y_inc( int y_start , int y_stop , int num_of_rows )
|
Remarks
|
Calculate the y axis increment per scale row.
|
Function
|
get_y_plot
|
Include file
|
G_WIN_R.H
|
Prototype
|
int get_y_plot( GDDS *gdds_ptr , float y_float )
|
Remarks
|
Return the calculated y plot location for the given data value.
|
Function
|
draw_empty_chart
|
Include file
|
G_WIN_R.H
|
Prototype
|
void draw_empty_chart( GDDS *gdds_ptr )
|
Remarks
|
Draw a virgin chart.
|
Function
|
GRX_grid
|
Include file
|
G_WIN_R.H
|
Prototype
|
void GRX_grid( GDDS *gdds_ptr , int x_start , int y_start , int x_stop , int y_stop ,
int num_of_cols , int num_of_rows , int box_the_grid )
|
Remarks
|
Multi-function grid and box draw routine. This routine is front-ended
by the following macros in G_WIN_R.H for various sub-functions, grid ( draws
a grid, boxed grid ( draw a grid and boxes it ), horz_dsh_lns ( draws
a series of horizontal dashed lines bounded by the x/y coordinates )
and vert_dsh_lns ( same as the last except vertical ). The x/y
coordinates are for the upper left corner ( x_start , y_start ) and the
lower right corner ( x_stop , y_stop ) of the desired area.
|
Function
|
GRX_box
|
Include file
|
G_WIN_R.H
|
Prototype
|
void GRX_box( GDDS *gdds_ptr , int x_start , int y_start , int x_stop , int y_stop )
|
Remarks
|
A simple draw a box around from upper left corner ( x_start , y_start )
to the lower right corner ( x_stop , y_stop ) of the desired area.
|
Function
|
line
|
Include file
|
G_WIN_R.H
|
Prototype
|
void line( GDDS *gdds_ptr ,
int x_start , int y_start , int x_stop , int y_stop )
|
Remarks
|
The function that the WIN32 api is missing :-) A simple MoveToEx( x_start ,
y_start ) and draw a LineTo( x_stop , y_stop ) in a single call.
|
Function
|
tick_x_axis
|
Include file
|
G_WIN_R.H
|
Prototype
|
void tick_x_axis( GDDS *gdds_ptr , int x_start , int y_loc ,
int tick_dir , int nolast_tick , int tick_length , int tick_interval )
|
Remarks
|
Draw a series of x axis tick marks.
|
Table of Contents
Function Index
IND_ENG.C - INDicator ENGine routines
A subsystem to easily run multiple indicators and systems in parallel
against a data set and then generate a custom report for the user.
Function
|
get_trade_signal
|
Include file
|
IND_ENG.H
|
Prototype
|
char * get_trade_signal( int signal )
|
Remarks
|
Use the signal value to index into an array of char strs of trade
signals and market state messages.
|
Function
|
set_token_ptrs
|
Include file
|
IND_ENG.H
|
Prototype
|
void set_token_ptrs( char *input_line )
|
Remarks
|
This is the first major routine used to parse the user's template line into
something meaningful. This routine will init all line parse vars and
ie_tokens[] array. It will then break the input_line into white-space
delimited NULL terminated token strings (this means input_line is changed).
At exit the the array token_cnt is set and the ie_tokens[].str sections look
like a AWK $1 , $2 .. $N token array (this means ie_tokens[ 0 ].str contains
the first token on the line, etc.).
|
Function
|
set_token_flags
|
Include file
|
IND_ENG.H
|
Prototype
|
void set_token_flags( void )
|
Remarks
|
Now that the ie_tokens[] array is built, we'll try is see if we can recognize
any of the tokens as special flag verbs. If we do - hit the appropriate
special flag and mark the token as used.
|
Function
|
special_token_saves
|
Include file
|
IND_ENG.H
|
Prototype
|
void special_token_saves( void )
|
Remarks
|
Now handle the parentheses and equal sign assignments (and mark as
used). Also update the cur_prc_rec->spec_output_flag if necessary.
|
Function
|
get_first_int_arg
|
Include file
|
IND_ENG.H
|
Prototype
|
int get_first_int_arg( void )
|
Remarks
|
Return the first token string after the primary verb that begins with
a digit and don't worry if it has been used yet. Return 0 if none found.
|
Function
|
get_first_unused_int_arg
|
Include file
|
IND_ENG.H
|
Prototype
|
int get_first_unused_int_arg( void )
|
Remarks
|
Return the first token string after the primary verb that begins with
a digit and this time check that it hasn't been used yet. Mark it as now
having been used. Return 0 if none found.
|
Function
|
get_first_unused_arg
|
Include file
|
IND_ENG.H
|
Prototype
|
char * get_first_unused_arg( void )
|
Remarks
|
Get the first unused argument of any type. If we are parsing a math
operation then we start with the first token str else we skip the primary
verb token and begin searching at the next token. Return NULL if none found.
|
Function
|
get_first_unused_arg_n_mark_used
|
Include file
|
IND_ENG.H
|
Prototype
|
char * get_first_unused_arg_n_mark_used( void )
|
Remarks
|
Get the first unused argument of any type. If we are parsing a math
operation then we start with the first token str else we skip the primary
verb token and begin searching at the next token. This time mark the found
one as used. Return NULL if none found.
|
Function
|
get_label_str
|
Include file
|
IND_ENG.H
|
Prototype
|
char * get_label_str( void )
|
Remarks
|
Try a number of sources to generate a label str for the cur_prc_rec. First
check if the user gave us one, if so, return a clone of it. Then check if
the cur_prc_rec is something other than a file constant. If it is and the
cur_prc_rec->spec_proc_flag does not have the NO_SIZE bit set then build a
label str consisting df_label[ verb_idx] plus the size value the user gave
us. Else just return the df_label[ verb_idx ].
|
Function
|
get_unused_label_str
|
Include file
|
IND_ENG.H
|
Prototype
|
char * get_unused_label_str( void )
|
Remarks
|
Scan the tokens and return the first unused label_str (and mark it as used)
or return NULL.
|
Function
|
get_label_str_secondary
|
Include file
|
IND_ENG.H
|
Prototype
|
char * get_label_str_secondary( int src_idx , int size )
|
Remarks
|
Return a copy of the secondary data source's label str. If size != 0
append it to the label str too.
|
Function
|
make_secondary_label_str
|
Include file
|
IND_ENG.H
|
Prototype
|
void make_secondary_label_str( char *buffer , char *df_msg )
|
Remarks
|
Check if we have an available user supplied label str and either copy it
(if found) else the df_msg into the caller's buffer.
|
Function
|
set_data_source_n_labels
|
Include file
|
IND_ENG.H
|
Prototype
|
void set_data_source_n_labels( int size )
|
Remarks
|
Set the data_source and label_str for the cur_prc_rec. Also hook the
label_str to the right slot in the ref_strs[ output_cnt ].
|
Function
|
chk_4_label_update_with_defaults
|
Include file
|
IND_ENG.H
|
Prototype
|
void chk_4_label_update_with_defaults( int size , char *use_this_label )
|
Remarks
|
If the user didn't give us a size on an indicator that has defaults, we
need to update the label_str with the indicator's default size. Also hook
the label_str to the right slot in the ref_strs[ output_cnt ].
|
Function
|
bld_ind_label_str
|
Include file
|
IND_ENG.H
|
Prototype
|
void bld_ind_label_str( char *base_str , int df_length )
|
Remarks
|
Build a indicator label str and hook it up to the ref_strs[ output_cnt ]
array.
|
Function
|
ie_get_format_str
|
Include file
|
IND_ENG.H
|
Prototype
|
char * ie_get_format_str( void )
|
Remarks
|
Return either the user provided format str else the df_formats[ verb_idx ].
|
Function
|
report_unused_tokens
|
Include file
|
IND_ENG.H
|
Prototype
|
void report_unused_tokens( void )
|
Remarks
|
OK everything is parsed, check if we've got anything marked as still
unused. If so, tell the user.
|
Function
|
set_output_formats
|
Include file
|
IND_ENG.H
|
Prototype
|
void set_output_formats( void )
|
Remarks
|
Set the default price data output format str (depending on output_places).
|
Function
|
clone_cur_prc_rec
|
Include file
|
IND_ENG.H
|
Prototype
|
void clone_cur_prc_rec( char *label_str , int no_out_flag , int no_tsig_flag )
|
Remarks
|
Clone a copy of the cur_prc_rec, update the ref_strs[ output_cnt ] array.
At exit the cur_prc_rec will point to the new PRC_REC.
|
Function
|
inc_cur_prc_rec
|
Include file
|
IND_ENG.H
|
Prototype
|
void inc_cur_prc_rec( void )
|
Remarks
|
Since prc_master->prc_rec[] is an array of ptrs a simple cur_prc_rec++
won't work.
|
Function
|
dec_cur_prc_rec
|
Include file
|
IND_ENG.H
|
Prototype
|
void dec_cur_prc_rec( void )
|
Remarks
|
ditto
|
Function
|
dump_ticker_str
|
Include file
|
IND_ENG.H
|
Prototype
|
void dump_ticker_str( char *ticker )
|
Remarks
|
Dump the ticker str to the report and to the user so he sees that
something is happening.
|
Function
|
rpt_template_error
|
Include file
|
IND_ENG.H
|
Prototype
|
void rpt_template_error( char *msg )
|
Remarks
|
Report that a error occured in parsing a template line.
|
Function
|
ln_to_upper_except_in_dquotes
|
Include file
|
IND_ENG.H
|
Prototype
|
void ln_to_upper_except_in_dquotes( char *str )
|
Remarks
|
Convert all lower case characters in a str to upper case except the
characters in between double quotes.
exp - this is a "test" becomes THIS IS A "test"
|
Function
|
eat_commas_except_in_dquotes
|
Include file
|
IND_ENG.H
|
Prototype
|
void eat_commas_except_in_dquotes( char *str )
|
Remarks
|
Change all commas found in a str to spaces except the ones inside
of double quotes.
|
Function
|
eat_white_space_in_str
|
Include file
|
IND_ENG.H
|
Prototype
|
void eat_white_space_in_str( char *src , char *dest ) // do the tighten-up
|
Remarks
|
Delete all white_space from a str.
|
Function
|
is_this_a_number_str
|
Include file
|
IND_ENG.H
|
Prototype
|
int is_this_a_number_str( char *target )
|
Remarks
|
Return TRUE is the target str is a number else FALSE.
|
Function
|
strncpy_n_blank_pad
|
Include file
|
IND_ENG.H
|
Prototype
|
void strncpy_n_blank_pad( char *dest , char *src , int len )
|
Remarks
|
Do a strncpy then space pad to the caller's request length.
|
Function
|
rpt_memory_left_if_debug_flag
|
Include file
|
IND_ENG.H
|
Prototype
|
void rpt_memory_left_if_debug_flag( void )
|
Remarks
|
If the debug_flag == TRUE then report currently available near memory.
|
Function
|
dump_prc_master_if_debug_flag
|
Include file
|
IND_ENG.H
|
Prototype
|
void dump_prc_master_if_debug_flag( void )
|
Remarks
|
If the debug_flag == TRUE then dump all the allocated process_records.
|
Function
|
output_cur_prc_rec
|
Include file
|
IND_ENG.H
|
Prototype
|
void output_cur_prc_rec( void )
|
Remarks
|
Dump a debug look at the process_record pointed at by cur_prc_rec.
|
Function
|
dump_ref_str_if_debug_flag
|
Include file
|
IND_ENG.H
|
Prototype
|
void dump_ref_str_if_debug_flag( void )
|
Remarks
|
If debug_flag == TRUE dump the whole ref_strs[] array.
|
Function
|
clear_the_prc_array
|
Include file
|
IND_ENG.H
|
Prototype
|
void clear_the_prc_array( void )
|
Remarks
|
Init all the process_records in the prc_master struct and call their
individual init_routines (if they have one).
|
Function
|
chk_4_post_proc_requests
|
Include file
|
IND_ENG.H
|
Prototype
|
void chk_4_post_proc_requests( void )
|
Remarks
|
Check for any post DATA_REC processing special requests.
|
Function
|
save_trade_signal_value
|
Include file
|
IND_ENG.H
|
Prototype
|
void save_trade_signal_value( int idx , int store_value )
|
Remarks
|
Update the out_ptr->signal_state[ idx ] with the requested new store_value
and handle forward_time processing.
|
Function
|
save_output_value
|
Include file
|
IND_ENG.H
|
Prototype
|
void save_output_value( float store_value )
|
Remarks
|
Update the out_ptr->data[ cur_prc_rec->output_idx ] with the requested
new store_value. Also handle user log requests and forward_time
processing.
|
Function
|
output_str_2_log_file
|
Include file
|
IND_ENG.H
|
Prototype
|
void output_str_2_log_file( char *str )
|
Remarks
|
Hook to here to allow support for user requested last N records.
|
Function
|
get_data_value
|
Include file
|
IND_ENG.H
|
Prototype
|
float get_data_value( void )
|
Remarks
|
Fetch the current value for the defined data_source for the cur_prc_rec.
This could be either a file constant or a previously calculated process
record. The GLOBAL var last_data_value is also set.
|
Function
|
general_data_store
|
Include file
|
IND_ENG.H
|
Prototype
|
void general_data_store( void )
|
Remarks
|
A generalized data store for all the file constants.
|
Function
|
cnvt_tbond_vars_if_necessary
|
Include file
|
IND_ENG.H
|
Prototype
|
void cnvt_tbond_vars_if_necessary( void )
|
Remarks
|
If bond_decimal == TRUE, find all process_records with their PRICE_DATA
bit set in spec_proc_flag and convert their output values back to T-Bond
1/32s format.
|
Function
|
init_out_array
|
Include file
|
IND_ENG.H
|
Prototype
|
void init_out_array( void )
|
Remarks
|
Init out_array to a double linked circular queue.
|
Function
|
clear_the_out_array
|
Include file
|
IND_ENG.H
|
Prototype
|
void clear_the_out_array( void )
|
Remarks
|
Clear all the out_ptr's data and signal_state buckets for all the
process records.
|
Function
|
output_the_out_array
|
Include file
|
IND_ENG.H
|
Prototype
|
void output_the_out_array( void )
|
Remarks
|
OK the processing is all done so dump the out_array to output_device and
give the user his report.
|
Function
|
compare_dates
|
Include file
|
IND_ENG.H
|
Prototype
|
static int compare_dates( float date1 , float date2 )
|
Remarks
|
A simple compare function that returns values like strcmp, 0 = match,
-1 = date1 < date2 and 1 = date1 > date2.
|
Function
|
find_rec_by_date
|
Include file
|
IND_ENG.H
|
Prototype
|
int find_rec_by_date( float target_date )
|
Remarks
|
Given a already open data file, search forward with retrys for a target
date. Calls find_rec_by_date2 for each attempt.
|
Function
|
find_rec_by_date2
|
Include file
|
IND_ENG.H
|
Prototype
|
static int find_rec_by_date2( float target_date )
|
Remarks
|
This routine will search a file for a target_date.
|
Function
|
test_find_rec_by_date
|
Include file
|
IND_ENG.H
|
Prototype
|
int test_find_rec_by_date( void )
|
Remarks
|
|
Function
|
load_secondary_data
|
Include file
|
IND_ENG.H
|
Prototype
|
void load_secondary_data( void )
|
Remarks
|
Load any user requested secondary data files into far memory DATA_REC
arrays for the whole program run.
|
Function
|
init_secondary_data_ptrs
|
Include file
|
IND_ENG.H
|
Prototype
|
void init_secondary_data_ptrs( void )
|
Remarks
|
Set the cur_sd?_rec and last_sd?_rec ptrs to the beginning of the
secondary data DATA_REC arrays.
|
Function
|
increment_secondary_data_ptrs
|
Include file
|
IND_ENG.H
|
Prototype
|
void increment_secondary_data_ptrs( void )
|
Remarks
|
Advanced the secondary data DATA_REC array ptrs.
|
Function
|
init_forward_data
|
Include file
|
IND_ENG.H
|
Prototype
|
void init_forward_data( void )
|
Remarks
|
Simulate new data by setting the current data record ptrs back with their
last_dt_rec ptrs.
|
Function
|
set_ptrs_2_next_day
|
Include file
|
IND_ENG.H
|
Prototype
|
void set_ptrs_2_next_day( void )
|
Remarks
|
Calculate the next trading forward into time and update the DATA_REC
current data record ptr dates.
|
Function
|
set_file_rec_numbers
|
Include file
|
IND_ENG.H
|
Prototype
|
void set_file_rec_numbers( void )
|
Remarks
|
Calculate where to start reading the file based on num_of_days_to_output,
days_needed and maybe start_date & last_date info. Will set
num_of_recs_2_read.
|
Function
|
load_the_data_array
|
Include file
|
IND_ENG.H
|
Prototype
|
DATA_REC * load_the_data_array( char *ticker )
|
Remarks
|
Allocate, load and return a DATA_REC array with
num_of_recs_2_read data records.
|
Function
|
cnvt_bond_data_into_decimal
|
Include file
|
IND_ENG.H
|
Prototype
|
void cnvt_bond_data_into_decimal( void )
|
Remarks
|
Convert the open,high,low and close fields of the main DATA_REC array
from T-Bond 1/32's into T-Bond decimal if necessary.
|
Function
|
process_the_data_array
|
Include file
|
IND_ENG.H
|
Prototype
|
void process_the_data_array( void )
|
Remarks
|
Run the process_records against the data arrays.
|
Function
|
calc_next_trading_date
|
Include file
|
IND_ENG.H
|
Prototype
|
float calc_next_trading_date( float last_rec_date )
|
Remarks
|
Convert a given date to the next market day.
|
Function
|
roll_2_tomorrow
|
Include file
|
IND_ENG.H
|
Prototype
|
UINT roll_2_tomorrow( UINT last_rec_julian )
|
Remarks
|
A simple (and stupid) advance to the next market day, holiday checking
is not done.
|
Function
|
set_trade_signal_state
|
Include file
|
IND_ENG.H
|
Prototype
|
void set_trade_signal_state( int idx , int opinion )
|
Remarks
|
Set and update the trade signal state for output number - idx according
to the opinion.
|
Function
|
update_trade_signal_state
|
Include file
|
IND_ENG.H
|
Prototype
|
void update_trade_signal_state( int idx )
|
Remarks
|
Update the current trade signal for state changes (exp. old state GO_LONG,
new state at exit - LONG).
|
Function
|
set_ind_signal_state
|
Include file
|
IND_ENG.H
|
Prototype
|
void set_ind_signal_state( int idx , float cur_value , float last_value )
|
Remarks
|
Calculate an indicator trade signal state using as a basis the current
and last indicator values.
|
Function
|
calc_ob_os_signal_state
|
Include file
|
IND_ENG.H
|
Prototype
|
void calc_ob_os_signal_state( int idx ,
float overbought_threshold , float oversold_threshold )
|
Remarks
|
Calculate an indicator trade signal state by evaluating the current
indicator value in relation to overbought and oversold thresholds.
|
Function
|
calc_rev_ob_os_signal_state
|
Include file
|
IND_ENG.H
|
Prototype
|
void calc_rev_ob_os_signal_state( int idx ,
float overbought_threshold , float oversold_threshold )
|
Remarks
|
This is the same as the last routine except this one has reversed
threshold logic to handle flakey thresholds like original Williams' %R.
|
Function
|
set_ob_os_ind_signal_state
|
Include file
|
IND_ENG.H
|
Prototype
|
void set_ob_os_ind_signal_state( int idx , int opinion )
|
Remarks
|
Set and update the indicator trade signal state using as a basis
the indicator value in relation to overbought and oversold thresholds.
|
Function
|
allocate_trd_signal_routine
|
Include file
|
IND_ENG.H
|
Prototype
|
void allocate_trd_signal_routine( void )
|
Remarks
|
Allocate and initialize a user requested trade signal process routine
structure and hook it on to the cur_prc_rec.
|
Function
|
chk_4_user_requested_trd_sig
|
Include file
|
IND_ENG.H
|
Prototype
|
int chk_4_user_requested_trd_sig( float cur_ind , float src_data )
|
Remarks
|
Check the cur_prc_rec's trd_sig_ptr, if a user requested special trade
signal routine is found, run it.
|
Function
|
fe_calc_ob_os_signal_state
|
Include file
|
IND_ENG.H
|
Prototype
|
void fe_calc_ob_os_signal_state( void )
|
Remarks
|
Front end calc_ob_os_signal_state() since function ptrs don't have
prototypes the float arguments get pushed as ints
|
Function
|
fe_set_ind_signal_state
|
Include file
|
IND_ENG.H
|
Prototype
|
void fe_set_ind_signal_state( void )
|
Remarks
|
Front end set_ind_signal_state() since function ptrs don't have prototypes
the float arguments get pushed as ints
|
Function
|
validate_with_str_array_stricmp
|
Include file
|
IND_ENG.H
|
Prototype
|
int validate_with_str_array_stricmp(
char *validate_strs[] , char *target , int cnt )
|
Remarks
|
Normal validate_with_str_array except use stricmp for a case-insensitive
compare between target and validate_strs.
|
Function
|
chk_data_tables
|
Include file
|
IND_ENG.H
|
Prototype
|
void chk_data_tables( void )
|
Remarks
|
This is a run-time check that all the definition tables are the same size.
|
Function
|
process_template_file
|
Include file
|
IND_ENG.H
|
Prototype
|
void process_template_file( char *template_file )
|
Remarks
|
Load and process a report template file into the process_records.
|
Function
|
process_1_template_line
|
Include file
|
IND_ENG.H
|
Prototype
|
void process_1_template_line( char *input_line )
|
Remarks
|
Worker routine to process a single template line into a process_record.
|
Function
|
init_ind_eng_vars
|
Include file
|
IND_ENG.H
|
Prototype
|
void init_ind_eng_vars( void )
|
Remarks
|
Initialize the program global and permanent variables.
|
Function
|
validate_primary_verb
|
Include file
|
IND_ENG.H
|
Prototype
|
void validate_primary_verb( void )
|
Remarks
|
Validate that the first token is a primary verb (or an abbreviation of
one). Will set the GLOBAL var verb_idx to either the matched verb or
max table size if not found.
|
Function
|
chk_if_valid_data_source
|
Include file
|
IND_ENG.H
|
Prototype
|
int chk_if_valid_data_source( int found_data_src )
|
Remarks
|
Check if found data source is valid for this primary verb.
|
Function
|
find_data_source
|
Include file
|
IND_ENG.H
|
Prototype
|
int find_data_source( char *request )
|
Remarks
|
Identify if the user request is a valid data source (or an abbreviation
of one). Also remaps the file constant data source to their special flag
numbers.
|
Function
|
rpt_current_state
|
Include file
|
IND_ENG.H
|
Prototype
|
void rpt_current_state( void )
|
Remarks
|
Do a run-time dump of the current state of all user visible indicator
variables.
|
Function
|
process_paren_assignment
|
Include file
|
IND_ENG.H
|
Prototype
|
void process_paren_assignment( int idx )
|
Remarks
|
Called when a set of parentheses is found in a token str (ie_tokens[ idx ]).
This code identifies which trading system the user is providing
overbought and oversold thresholds for, and then stores them.
Example - threshold_trd_sig( 2000 , -2000 )
|
Table of Contents
Function Index
ip_ports.c - Internet Protocol PORTS routines
This is the main initialization file for the TCP & UDP PORTS subsystem.
This subsystem supports TCP sending or receiving and UDP broadcasting &
receiving of datagrams (ASCII or binary data) using the Windows 32 bit
winsock DLL. This module contains the alloc & free code as well as the
connect to the DLL code required by Windows.
Function
|
alloc_IP_SOCK
|
Include file
|
IP_PORTS.H
|
Prototype
|
IP_SOCK * alloc_IP_SOCK( int type )
|
Remarks
|
Allocate, initialize and return a IP socket structure. The type can be
either SOCKET_UDP or SOCKET_TCP. This routine is front-ended by 2 macros
alloc_udp_connection() and alloc_tcp_connection(). This routine will also
load WIN32's winsock.
|
Function
|
free_IP_SOCK
|
Include file
|
IP_PORTS.H
|
Prototype
|
void free_IP_SOCK( IP_SOCK *ip_ptr )
|
Remarks
|
Close and free either type of IP_SOCK.
|
Function
|
connect_to_winsock
|
Include file
|
IP_PORTS.H
|
Prototype
|
void connect_to_winsock( void )
|
Remarks
|
Make sure we've got a reasonably new WIN32 winsock (and load it).
|
Function
|
send_datagram
|
Include file
|
IP_PORTS.H
|
Prototype
|
int send_datagram( IP_SOCK *ip_ptr )
|
Remarks
|
Send a UDP datagram out the socket.
|
Function
|
receive_datagram
|
Include file
|
IP_PORTS.H
|
Prototype
|
int receive_datagram( IP_SOCK *ip_ptr )
|
Remarks
|
Receive a UDP datagram from the socket. This code supports both blocked
and non-blocked reads.
|
Function
|
load_datagram
|
Include file
|
IP_PORTS.H
|
Prototype
|
void load_datagram( IP_SOCK *ip_ptr , void *dt_buff , int size )
|
Remarks
|
Check max size and load an IP_SOCK's datagram area with a user data buffer.
|
Table of Contents
Function Index
lcappstr.c - LoCalized APPlication STRings
A QND to initialize some message strings suitable for use by
db_printf for LAN wide msg reporting.
Function
|
build_app_db_msg_prefixes
|
Include file
|
LCAPPSTR.H
|
Prototype
|
void build_app_db_msg_prefixes( char *prg_abbrev )
|
Remarks
|
Just sprintf the various status level msg buffers with the standard
strs and the passed in user program abbreviation str.
|
Table of Contents
Function Index
msbin2ie.c - MicroSoft BINary float 2 IEee float conversion routines
MicroSoft basic BINary float format 2 IEee float conversion routines
The following are implementations of the Microsoft RTL functions
that Borland has never had and that recently Microsoft dropped from
their RTL. This code originated from Borlands BBS in 93 and was cleaned
up by TDF.
These functions convert back and forth from Microsoft binary format
to IEEE floating point format.
As with the Microsoft RTL functions,
m3 m2 m1 exponent
Function
|
fmsbintoieee
|
Include file
|
MSBIN2IE.H
|
Prototype
|
int fmsbintoieee( float *src , float *dest )
|
Remarks
|
Convert a 4 byte Microsoft binary to a IEEE 4 byte float.
|
Function
|
fieeetomsbin
|
Include file
|
MSBIN2IE.H
|
Prototype
|
int fieeetomsbin( float *src , float *dest )
|
Remarks
|
Convert a IEEE 4 byte float to a 4 byte Microsoft binary.
|
Table of Contents
Function Index
perlsupp.c - PERL SUPPort
Just a couple of front-ends to standard library functions to
handle copying data back into perl's memory space.
Function
|
ps_load_last_n_data_records
|
Include file
|
PERLSUPP.H
|
Prototype
|
int ps_load_last_n_data_records(
char *ticker , int last_cnt , LPTSTR *data_buff )
|
Remarks
|
Load some DATA_RECs and send them back to perl space.
|
Table of Contents
Function Index
qsw_demo.c - Quote Screen Window DEMO program
This is simple demo app for the QS_WIN (Quote Screen Windows) routines.
Function
|
WinMain
|
Include file
|
QSW_DEMO.H
|
Prototype
|
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow )
|
Remarks
|
Main entry point for QSW_DEMO.
|
Function
|
process_cmd_line_4_arguments
|
Include file
|
QSW_DEMO.H
|
Prototype
|
void process_cmd_line_4_arguments( LPSTR lpCmdLine )
|
Remarks
|
Process the user's command line arguments into a argv array which then is
processed by the normal getargs() procedure to store the data into the
programs switch flags.
|
Function
|
localQSWndProc
|
Include file
|
QSW_DEMO.H
|
Prototype
|
LONG WINAPI localQSWndProc(
HWND hWnd , UINT messg , UINT wParam , LONG lParam )
|
Remarks
|
This is the local QSWndProc. It's main job is supporting keyboard input
to honor exit requests and to support a timer_tick routine to generate
new display data.
|
Function
|
timer_test_routine
|
Include file
|
QSW_DEMO.H
|
Prototype
|
void timer_test_routine( QS_WIN *w_ptr )
|
Remarks
|
Generate new display data and update the screen display interface list.
|
Function
|
fake_num_data
|
Include file
|
QSW_DEMO.H
|
Prototype
|
void fake_num_data( QS_WIN *w_ptr )
|
Remarks
|
Generate some simple fake number data.
|
Table of Contents
Function Index
qs_win_r.c - Quote Screen WINdow Routines
This is the quote screen display window subsystem. A QS_WIN allows
the display of integers, floats and strings in pre-defined locations.
The window is repainted every 200 milliseconds (by default) with new data.
The field can be displayed in any of 16,777,216 colors and the filed can be
set to "color flash" the field display in a different color for a set
period of time. At the end of the flash period the field will be
automatically be repaint in the default color.
From a high level view a QS_WIN is constructed by these data structures.
A single QS_WIN struct controls the window construction information like
client sizes, data cnts, titles and WIN32 objects like brushes, dc's,
window handles and bitmaps. It then has 1 to N number of SDAs (Screen
Display Atoms) records attached to it take provide the actual text field
data to be displayed. The SDA is built from a QI structure defined by macros
in qs_win_r.h. There is also a SDIL (Screen Display Interface List) which
is user by the client program to update all fields for a given variable
in the QS_WIN with the new var value.
Function
|
alloc_QS_WIN
|
Include file
|
QS_WIN_R.H
|
Prototype
|
QS_WIN * alloc_QS_WIN( void )
|
Remarks
|
Allocate and initialize a QS_WIN struct.
|
Function
|
regQSWINClass
|
Include file
|
QS_WIN_R.H
|
Prototype
|
ATOM regQSWINClass( QS_WIN *qs_ptr )
|
Remarks
|
Register a QS_WIN class object with Window32.
|
Function
|
QSWndProc
|
Include file
|
QS_WIN_R.H
|
Prototype
|
LONG QSWndProc(
HWND hWnd , UINT messg , UINT wParam , LONG lParam )
|
Remarks
|
The main WndProc for the QS_WIN.
|
Function
|
get_format_str
|
Include file
|
QS_WIN_R.H
|
Prototype
|
char * get_format_str( int format_type )
|
Remarks
|
Convert the stored format type in a format string suitable for use
by a printf routine.
|
Function
|
float_to_sda_buff
|
Include file
|
QS_WIN_R.H
|
Prototype
|
void float_to_sda_buff( SDA *a_ptr , float new_val )
|
Remarks
|
Write a float value to a SDA (screen display atom) output buffer.
|
Function
|
int_to_sda_buff
|
Include file
|
QS_WIN_R.H
|
Prototype
|
void int_to_sda_buff( SDA *a_ptr , int new_val )
|
Remarks
|
Write a integer value to a SDA output buffer.
|
Function
|
str_to_sda_buff
|
Include file
|
QS_WIN_R.H
|
Prototype
|
void str_to_sda_buff( SDA *a_ptr , char *new_val )
|
Remarks
|
Copy a string value to a SDA output buffer.
|
Function
|
str_to_sda_buff_with_pad
|
Include file
|
QS_WIN_R.H
|
Prototype
|
void str_to_sda_buff_with_pad( SDA *a_ptr , char *new_val )
|
Remarks
|
Write a string value to a SDA output buffer and pad it to size.
|
Function
|
insert_sda_item
|
Include file
|
QS_WIN_R.H
|
Prototype
|
void insert_sda_item( QSD *q_ptr , SDA *a_ptr )
|
Remarks
|
Insert a SDA object into the list hanging off of the QSD (quote screen
display).
|
Function
|
build_quote_scr
|
Include file
|
QS_WIN_R.H
|
Prototype
|
QSD * build_quote_scr( QI *scr_proto , int item_cnt , SDIL *interface_list_ptr )
|
Remarks
|
Allocate and initialize a QSD object. Then process a quote screen
prototype structure in a SDA list. And also hook up the new SDA's to the
SDIL (screen display interface list) so changes to the vars can be
reflected back to the screen.
|
Function
|
paint_quote_scr
|
Include file
|
QS_WIN_R.H
|
Prototype
|
void paint_quote_scr( QS_WIN *w_ptr )
|
Remarks
|
Walk the list of SDA's hooked to the window and check the refresh
flag. If we need a refresh for a given SDA - write its sda_buff to
the window via a TextOut.
|
Table of Contents
Function Index
reg_r.c - REGistry Routines
A few simple registry routines (but all you need - read, write & delete).
Function
|
fetch_str_from_registry
|
Include file
|
REG_R.H
|
Prototype
|
int fetch_str_from_registry( HKEY hRootKey ,
LPTSTR sub_path , LPTSTR value_name , char *buff , int buff_size )
|
Remarks
|
Given an open registry key and a sub-path, search for a value named -
value_name. If found copy the string data into the user's buffer,
honoring buff_size as a max value. This routine will return
ERROR_SUCCESS - for all ok, ERROR_INVALID_DATA - if the value
data is not a string and ERROR_INSUFFICIENT_BUFFER if the buffer
is not big enough.
|
Function
|
write_str_to_registry
|
Include file
|
REG_R.H
|
Prototype
|
int write_str_to_registry(
HKEY hRootKey , LPCTSTR sub_path , LPTSTR value_name , char *buff )
|
Remarks
|
Given an open registry key and a sub-path - write a value tag to the
registry named - value_name and consisting of the data - buff.
|
Function
|
delete_str_from_registry
|
Include file
|
REG_R.H
|
Prototype
|
int delete_str_from_registry(
HKEY hRootKey , LPTSTR sub_path , LPTSTR value_name )
|
Remarks
|
Given an open registry key and a sub-path - delete the value tag in the
registry named - value_name.
|
Function
|
delete_key_from_registry
|
Include file
|
REG_R.H
|
Prototype
|
int delete_key_from_registry(
HKEY hRootKey , LPTSTR sub_path , LPTSTR key_str )
|
Remarks
|
Given an open registry key and a sub-path - delete the key in the registry
named - key_str.
|
Table of Contents
Function Index
ser_port.c - SERial PORT routines
This is a quick hack & slash of the serial port code from tdf_tty
into a module for use by dtserver. The API is the same as TCP/UDP
in ip_ports. Since this is a QND - I also am reusing the IP_SOCK
structure. But this does have a benefit though - you can easily
change data input streams in a program to & from serial to
Ethernet IP.
Warning - this code does not fully support binary data. It currently
expects to handle ASCII records terminated by '\n'.
Function
|
init_to_receive_on_serial_port
|
Include file
|
SER_PORT.H
|
Prototype
|
int init_to_receive_on_serial_port(
IP_SOCK *serial_in , LPTSTR com_port , int port_speed )
|
Remarks
|
Initialize and open up a com port and make it look like a socket
(using a circular buffer). The com_port string is a standard DOS
"COM1" - "COM4" string. And port_speed is baud rate. This routine
will also open up another thread to handle the actual port events.
|
Function
|
CommWatchProc
|
Include file
|
SER_PORT.H
|
Prototype
|
DWORD FAR PASCAL CommWatchProc( LPSTR lpData )
|
Remarks
|
This is the event Proc to handle the serial port.
|
Function
|
ReadCommBlock
|
Include file
|
SER_PORT.H
|
Prototype
|
int NEAR ReadCommBlock( LPSTR lpszBlock, int nMaxLength )
|
Remarks
|
Read the comm port and store the input in the circular buffer.
|
Function
|
receive_serial_datagram
|
Include file
|
SER_PORT.H
|
Prototype
|
int receive_serial_datagram( IP_SOCK *serial_in )
|
Remarks
|
Read the serial port's circular buffer and move its data into the IP_SOCK's
datagram buffer for delivery back to the caller.
|
Table of Contents
Function Index
sig_data.c - SIGnal DATA collection routines
a hack of the routines from sig_dnld.c to data collect under Windows.
Function
|
chk_if_tokens_same_len
|
Include file
|
SIG_DATA.H
|
Prototype
|
int chk_if_tokens_same_len(
char *close_ptr , char *high_ptr , char *low_ptr , char *open_ptr ) ;
int chk_for_null_token( char *target , int err_idx ) ;
void chk_for_reload_from_checkpoint( void ) ;
void test_hook( void ) ;
|
Remarks
|
|
Function
|
ld_ascii_data_file
|
Include file
|
SIG_DATA.H
|
Prototype
|
|
Remarks
|
//void ld_ascii_data_file(
char *file_name , FPTR process_routine , BOOL echo_flag ) ;
void set_system_time( int hour , int min , int sec ) ;
long get_system_time( void ) ;
|
Function
|
init_sig_data_vars
|
Include file
|
SIG_DATA.H
|
Prototype
|
void init_sig_data_vars( void )
|
Remarks
|
Application start-up so init the Signal data collection subsystem.
Allocate the input buffer and set the pointers. Build the initial collection
binary tree and init the time event queue. And lastly open the debug &
market message log file and send a startup msg out the debug port.
|
Function
|
output_sig_data
|
Include file
|
SIG_DATA.H
|
Prototype
|
void output_sig_data( void )
|
Remarks
|
Main call to get the signal data flushed to disk.
|
Function
|
store_input_data
|
Include file
|
SIG_DATA.H
|
Prototype
|
void store_input_data( char *inBuff )
|
Remarks
|
Here is where fresh data from the serial port enters the subsystem.
Move the data character by character in the input buffer. If the current
character is the NEWLINE then we have a complete quote message. So call
store_a_quote_line() to get it added to the tree. And last thing as we are
leaving we check the time event queue.
|
Function
|
output_daily_data
|
Include file
|
SIG_DATA.H
|
Prototype
|
void output_daily_data( char *output_file_name )
|
Remarks
|
Walk the collection tree and output the current values to a disk file
named - output_file_name. And set the dirty flag to FALSE.
|
Function
|
do_special_processing_b4_output
|
Include file
|
SIG_DATA.H
|
Prototype
|
void do_special_processing_b4_output( DT_REC node )
|
Remarks
|
This is a hook routine. Check if we need to do any special processing on
the given ticker before we output it. Current the routine does 2 things.
For TBond data it converts the 1/32's in decimal values. And for user marked
secondary indexes like Value Line and S & P it clones the NYSE volume
to the node.
|
Function
|
convert_tbond_quote
|
Include file
|
SIG_DATA.H
|
Prototype
|
void convert_tbond_quote( DT_REC node )
|
Remarks
|
For this node (which we know is a TBond quote) convert the price from
1/32 style to decimal.
|
Function
|
mins_past_midnight_to_HH_MM
|
Include file
|
SIG_DATA.H
|
Prototype
|
char *mins_past_midnight_to_HH_MM( int bin_time )
|
Remarks
|
Convert a minutes past midnight binary time into a "HH:MM" string and
return it to the caller.
|
Function
|
add_time_convert
|
Include file
|
SIG_DATA.H
|
Prototype
|
void add_time_convert( char *quote_line )
|
Remarks
|
If the last value of the quote looks like a minutes past midnight value
convert it to a user-friendly "HH:MM" string and append it to the quote string.
|
Function
|
store_current_btree_node
|
Include file
|
SIG_DATA.H
|
Prototype
|
void store_current_btree_node( DT_REC node )
|
Remarks
|
This is the main dispatch point to store the current quote string into the
found node. Before the store add a time_convert to the quote. Do a switch
branch for the correct node type. And maybe also echo the quote string out
the data_channel.
|
Function
|
store_current_node_index
|
Include file
|
SIG_DATA.H
|
Prototype
|
void store_current_node_index( DT_REC node )
|
Remarks
|
Validate and maybe store the current index quote into the given node.
|
Function
|
chk_token_size
|
Include file
|
SIG_DATA.H
|
Prototype
|
int chk_token_size( char *target1 , char *target2 )
|
Remarks
|
Compare two price string and if the larger is more than 150 % bigger then
the smaller assume one is a bad quote and return TRUE to signal a bad
tick. (Also log the error to disk and out the debug port.)
|
Function
|
chk_if_tokens_same_len
|
Include file
|
SIG_DATA.H
|
Prototype
|
int chk_if_tokens_same_len(
char *close_ptr , char *high_ptr , char *low_ptr , char *open_ptr )
|
Remarks
|
Check if the quote ptrs are all the same length. If not check the percentage
sizes of the data values with chk_token_size() before deciding that this
is a bad tick. Return TRUE is bad. (And again log the error to the disk file
and out the debug port.)
|
Function
|
store_current_node_future
|
Include file
|
SIG_DATA.H
|
Prototype
|
void store_current_node_future( DT_REC node )
|
Remarks
|
Validate and maybe store the current futures quote into the given node.
This code is for TradeStation version 3.5.
|
Function
|
store_current_node_future
|
Include file
|
SIG_DATA.H
|
Prototype
|
void store_current_node_future( DT_REC node )
|
Remarks
|
Validate and maybe store the current futures quote into the given node.
This code is for TradeStation version 4.0.
|
Function
|
store_current_node_stock
|
Include file
|
SIG_DATA.H
|
Prototype
|
void store_current_node_stock( DT_REC node )
|
Remarks
|
Validate and maybe store the current stock quote into the given node.
|
Function
|
store_current_node_m_fund
|
Include file
|
SIG_DATA.H
|
Prototype
|
void store_current_node_m_fund( DT_REC node )
|
Remarks
|
Validate and maybe store the current mutual fund quote into the given node.
|
Function
|
store_current_node_mrk_msg
|
Include file
|
SIG_DATA.H
|
Prototype
|
void store_current_node_mrk_msg( DT_REC node )
|
Remarks
|
Market messages are a little different. The node is just a hook to get us
here. If the msg_file is open - write the msg to disk and send the msg
out the msg_channel.
|
Function
|
store_scale_factor
|
Include file
|
SIG_DATA.H
|
Prototype
|
void store_scale_factor( DT_REC node , int idx )
|
Remarks
|
Convert the Signal scale character into floats - scale_factor and places and
update the vars in the node.
|
Function
|
set_type_4_virgin_btree_node
|
Include file
|
SIG_DATA.H
|
Prototype
|
void set_type_4_virgin_btree_node( DT_REC node )
|
Remarks
|
Set the type for the new node from the second token in the quote str.
|
Function
|
lc_add_btree_node
|
Include file
|
SIG_DATA.H
|
Prototype
|
DT_REC lc_add_btree_node( char *key_str )
|
Remarks
|
Local add_btree_node(). The only difference from the library routine is
the setting of the node type string by set_type_4_virgin_btree_node().
|
Function
|
lc_add_2_binary_tree
|
Include file
|
SIG_DATA.H
|
Prototype
|
DT_REC lc_add_2_binary_tree( DT_REC node , char *key_str )
|
Remarks
|
Local add_2_binary_tree() - same as the standard routine (except of course
the DT_REC structure :-).
|
Function
|
lc_find_btree_node
|
Include file
|
SIG_DATA.H
|
Prototype
|
DT_REC lc_find_btree_node( DT_REC node , char *key_str )
|
Remarks
|
Local find_btree_node().
|
Function
|
lc_find_btree_node_with_chk
|
Include file
|
SIG_DATA.H
|
Prototype
|
DT_REC lc_find_btree_node_with_chk( DT_REC node , char *key_str )
|
Remarks
|
This is a local find_btree_node() with one important difference. If the
target node is not in the collection tree, then return a pointer to a empty
dummy structure.
|
Function
|
lc_walk_binary_tree
|
Include file
|
SIG_DATA.H
|
Prototype
|
void lc_walk_binary_tree( DT_REC node , FPTR process_routine )
|
Remarks
|
A local walk_binary_tree() .
|
Function
|
output_btree_node
|
Include file
|
SIG_DATA.H
|
Prototype
|
void output_btree_node( DT_REC node )
|
Remarks
|
Output a given node to disk. First copy the node to a temporary DT_REC so
any special scaling or conversion before output will not effect the collecting
node. Then do a switch branch for the different data types.
|
Function
|
output_btree_node_future
|
Include file
|
SIG_DATA.H
|
Prototype
|
void output_btree_node_future( DT_REC node )
|
Remarks
|
Dump a futures quote to disk honoring the calculated places.
|
Function
|
output_btree_node_index
|
Include file
|
SIG_DATA.H
|
Prototype
|
void output_btree_node_index( DT_REC node )
|
Remarks
|
Dump a market index quote to disk honoring the calculated places.
|
Function
|
output_btree_node_stock
|
Include file
|
SIG_DATA.H
|
Prototype
|
void output_btree_node_stock( DT_REC node )
|
Remarks
|
Dump a stock quote to disk honoring the calculated places.
|
Function
|
output_btree_node_m_fund
|
Include file
|
SIG_DATA.H
|
Prototype
|
void output_btree_node_m_fund( DT_REC node )
|
Remarks
|
Dump a mutual fund quote to disk honoring the calculated places.
|
Function
|
dump_ticker_array
|
Include file
|
SIG_DATA.H
|
Prototype
|
void dump_ticker_array( void )
|
Remarks
|
For debugging purposes - dump the collection tree to disk.
|
Function
|
lc_print_btree_node
|
Include file
|
SIG_DATA.H
|
Prototype
|
void lc_print_btree_node( DT_REC node )
|
Remarks
|
Do a debug dump for a given ticker node.
|
Function
|
compress_daily_data_file
|
Include file
|
SIG_DATA.H
|
Prototype
|
void compress_daily_data_file( void )
|
Remarks
|
This is a hook routine to compress the daily output file. For easy parsing
when I first write the file I included lots of white space. Then after the
file has been stored in my databases I rerun TDY_TTY and eat the white space.
(All done automatically via a batch file - you don't expect me to type do you?)
|
Function
|
compress_a_daily_quote
|
Include file
|
SIG_DATA.H
|
Prototype
|
void compress_a_daily_quote( char *quote )
|
Remarks
|
Compress one line.
|
Function
|
store_a_quote_line
|
Include file
|
SIG_DATA.H
|
Prototype
|
void store_a_quote_line( char *input_line )
|
Remarks
|
This is the main routine to actually store the quote string. It will first
echo the quote str out the echo_channel. Then it will set the parsing pointers.
If this is a time stamp msg - it will be processed and the routine will split.
Else if it is long enough it must be a data quote, so check the tree to see if
we have seen it already - if not add a new node to the tree. Then call
store_current_btree_node() to get the actual store done.
|
Function
|
set_token_ptrs
|
Include file
|
SIG_DATA.H
|
Prototype
|
void set_token_ptrs( char *buff )
|
Remarks
|
Process the input quote string buff by walking the buffer and setting
the token ptrs to the beginning of each token string and NULL-ing out
each comma character "," to terminate each token str.
|
Function
|
test_hook
|
Include file
|
SIG_DATA.H
|
Prototype
|
void test_hook( void )
|
Remarks
|
This is a test hook for new development testing.
|
Function
|
init_collection_tree
|
Include file
|
SIG_DATA.H
|
Prototype
|
void init_collection_tree( void )
|
Remarks
|
Initialize the collection tree with a few dummy nodes for tree balancing
and a few special data nodes.
|
Function
|
build_special_data
|
Include file
|
SIG_DATA.H
|
Prototype
|
void build_special_data( void )
|
Remarks
|
Lookup up a bunch of market tickers and update the special dow data
nodes with the combined info.
Dow Data file layouts -
A date , avol , dvol , nyv , adv
B date , adv , tick , trin , decl
C date , 1st hr change , 1st hr vol , last hr change , last hr vol
D date , 0.0 , 0.0 , Adv - Decl , 0.0
normal date , high , low , close , volume
|
Function
|
update_clone_nyse_volume
|
Include file
|
SIG_DATA.H
|
Prototype
|
void update_clone_nyse_volume( void )
|
Remarks
|
Clone the NYSE volume to a bunch of other market index tickers.
|
Function
|
update_dt_rec_with_nyse_volume
|
Include file
|
SIG_DATA.H
|
Prototype
|
void update_dt_rec_with_nyse_volume( char *target )
|
Remarks
|
Update the given ticker with the NYSE volume.
|
Function
|
init_time_event_queue
|
Include file
|
SIG_DATA.H
|
Prototype
|
void init_time_event_queue( void )
|
Remarks
|
Initialize the time event queue.
|
Function
|
chk_time_event_queue
|
Include file
|
SIG_DATA.H
|
Prototype
|
void chk_time_event_queue( void )
|
Remarks
|
Check if we have a time event firing.
|
Function
|
chk_4_special_output_format
|
Include file
|
SIG_DATA.H
|
Prototype
|
void chk_4_special_output_format( DT_REC node )
|
Remarks
|
Check if we want a special output format for the given ticker.
This currently only modifies future tickers.
|
Function
|
chk_if_numeric_str
|
Include file
|
SIG_DATA.H
|
Prototype
|
int chk_if_numeric_str( char *ticker )
|
Remarks
|
A simple check to filter out numbers from being stored as tickers.
|
Function
|
chk_for_null_token
|
Include file
|
SIG_DATA.H
|
Prototype
|
int chk_for_null_token( char *target , int err_idx )
|
Remarks
|
Check if a token ptr that should be pointing to a valid token str is instead
pointing to a NULL str (bad tick).
|
Function
|
chk_if_token_too_long
|
Include file
|
SIG_DATA.H
|
Prototype
|
int chk_if_token_too_long( char *target , int len , int err_idx )
|
Remarks
|
Check if a token str is longer than it should be (bad tick).
|
Function
|
dump_token_ptrs
|
Include file
|
SIG_DATA.H
|
Prototype
|
void dump_token_ptrs( void )
|
Remarks
|
Dump the token ptr array to the debug port.
|
Function
|
cnvt_to_system_time
|
Include file
|
SIG_DATA.H
|
Prototype
|
long cnvt_to_system_time( int hour , int min , int sec )
|
Remarks
|
Convert the given HH:MM:SS value into seconds past midnight.
|
Function
|
get_system_time
|
Include file
|
SIG_DATA.H
|
Prototype
|
long get_system_time( void )
|
Remarks
|
Get the current time in seconds past midnight.
|
Function
|
chk_for_reload_from_checkpoint
|
Include file
|
SIG_DATA.H
|
Prototype
|
void chk_for_reload_from_checkpoint( void )
|
Remarks
|
//
|
Function
|
reload_a_quote
|
Include file
|
SIG_DATA.H
|
Prototype
|
void reload_a_quote( char *str )
|
Remarks
|
//
|
Function
|
eat_trailing_white_space
|
Include file
|
SIG_DATA.H
|
Prototype
|
void eat_trailing_white_space( char *str )
|
Remarks
|
Delete trailing white space from a str.
|
Function
|
cnvt_nl_2_null
|
Include file
|
SIG_DATA.H
|
Prototype
|
void cnvt_nl_2_null( char *str )
|
Remarks
|
Replace all embedded newlines in source str with \000 (yielding
substrings in the main string).
|
Function
|
ld_ascii_data_file
|
Include file
|
SIG_DATA.H
|
Prototype
|
void ld_ascii_data_file(
char *file_name , FPTR process_routine , BOOL echo_flag )
|
Remarks
|
Load a ASCII file and call a process routine for each line of the file.
Set echo_flag to TRUE to get a debug dump to scr. If the process routine
wants to know where it is it should IMPORT and reference ASCII_line_num.
The process routine should expect one parameter, a char *. Lines beginning
with a COMMENT_CHAR (currently defined as "#") will not to sent to the
process_routine.
|
Function
|
set_system_time
|
Include file
|
SIG_DATA.H
|
Prototype
|
void set_system_time( int hour , int min , int sec )
|
Remarks
|
A simple set system time (for Windows 95 only.)
|
Table of Contents
Function Index
tcp_port.c - Transmission Control Protocol PORT routines
This code supports read & write operations for the TCP
port subsystem.
This is standard UNIX code from Stevens ported to Windows.
Function
|
init_to_receive_tcp_on_port
|
Include file
|
TCP_PORT.H
|
Prototype
|
int init_to_receive_tcp_on_port(
IP_SOCK *t_ptr , UWORD port_num , int is_blocking )
|
Remarks
|
Initialize and open up a TCP socket for read on a port. The socket
can be set for blocking or non-blocking IO and will be listening for
incoming connections.
|
Function
|
init_to_send_to_host
|
Include file
|
TCP_PORT.H
|
Prototype
|
int init_to_send_to_host( IP_SOCK *t_ptr , char *host , UWORD port )
|
Remarks
|
Initialize a connection to a target host for TCP writes.
|
Function
|
make_connection
|
Include file
|
TCP_PORT.H
|
Prototype
|
int make_connection( IP_SOCK *t_ptr )
|
Remarks
|
Make a connection request to a remote listening socket.
|
Function
|
accept_connection
|
Include file
|
TCP_PORT.H
|
Prototype
|
int accept_connection( IP_SOCK *t_ptr )
|
Remarks
|
Accept an incoming connection request on a listening socket and reset it
over to the new port number.
|
Table of Contents
Function Index
tdf_dlgs.c -
A simple dialog prompt box suitable for use from perl.
Function
|
get_edit_field_with_prompt
|
Include file
|
TDF_DLGS.H
|
Prototype
|
int get_edit_field_with_prompt( char *prompt_str ,
char *window_title , char *return_buff , int max_read )
|
Remarks
|
Call in from perl to pop-up a Windows dialog to get a str from the user.
|
Function
|
get_field_dlg_proc
|
Include file
|
TDF_DLGS.H
|
Prototype
|
BOOL WINAPI get_field_dlg_proc(
HWND hDlg , UINT uMsg , WPARAM wParam , LPARAM lParam )
|
Remarks
|
Dialog box WndProc handleer.
|
Table of Contents
Function Index
tdf_tty.c - TDF TTY program
A useful little utility to snarf a Signal data
stream from a serial port, save the quotes and broadcast a
data stream out the Ethernet to other clients.
The serial port code comes from a Microsoft SDK sample TTY.C
which I have layeried my code on top of. Warning - the SIG_DATA.C
module does not claim to handle all of the Signal data stream.
I do not have the Signal SDK, this is a simple example which
will grab most things (futures, mutual funds, stocks, indexes +
market messages & time stamps). If you expand that code or have
further info on the data stream, I'd be interested in seeing it.
This program is also a good example of using the udp socket
module to broadcast data to other programs on your LAN. It
also demos the use of the DeBug Message PORT routines
(DBM_PORT.C) for leaving embedded debug code in shipping apps.
Function
|
WinMain
|
Include file
|
TDF_TTY.H
|
Prototype
|
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow )
|
Remarks
|
Main program entry point.
|
Function
|
InitApplication
|
Include file
|
TDF_TTY.H
|
Prototype
|
BOOL NEAR InitApplication( HANDLE hInstance )
|
Remarks
|
First time initialization stuff.
|
Function
|
InitInstance
|
Include file
|
TDF_TTY.H
|
Prototype
|
HWND NEAR InitInstance( HANDLE hInstance, int nCmdShow )
|
Remarks
|
Initializes instance specific information.
|
Function
|
TTYWndProcOld
|
Include file
|
TDF_TTY.H
|
Prototype
|
LRESULT FAR PASCAL TTYWndProcOld( HWND hWnd, UINT uMsg,
WPARAM wParam, LPARAM lParam )
|
Remarks
|
This is the TTY Window Proc.
|
Function
|
CreateTTYInfo
|
Include file
|
TDF_TTY.H
|
Prototype
|
LRESULT NEAR CreateTTYInfo( HWND hWnd )
|
Remarks
|
Creates the tty information structure and sets menu option availability.
Returns -1 if unsuccessful.
|
Function
|
DestroyTTYInfo
|
Include file
|
TDF_TTY.H
|
Prototype
|
BOOL NEAR DestroyTTYInfo( HWND hWnd )
|
Remarks
|
Destroys block associated with TTY window handle.
|
Function
|
ResetTTYScreen
|
Include file
|
TDF_TTY.H
|
Prototype
|
BOOL NEAR ResetTTYScreen( HWND hWnd, NPTTYINFO npTTYInfo )
|
Remarks
|
Resets the TTY character information and causes the screen to resize to update
the scroll information.
|
Function
|
PaintTTY
|
Include file
|
TDF_TTY.H
|
Prototype
|
BOOL NEAR PaintTTY( HWND hWnd )
|
Remarks
|
Paints the rectangle determined by the paint struct of the DC.
|
Function
|
SizeTTY
|
Include file
|
TDF_TTY.H
|
Prototype
|
BOOL NEAR SizeTTY( HWND hWnd, WORD wVertSize, WORD wHorzSize )
|
Remarks
|
Sizes TTY and sets up scrolling regions.
|
Function
|
ScrollTTYVert
|
Include file
|
TDF_TTY.H
|
Prototype
|
BOOL NEAR ScrollTTYVert( HWND hWnd, WORD wScrollCmd, WORD wScrollPos )
|
Remarks
|
Scrolls TTY window vertically.
|
Function
|
ScrollTTYHorz
|
Include file
|
TDF_TTY.H
|
Prototype
|
BOOL NEAR ScrollTTYHorz( HWND hWnd, WORD wScrollCmd, WORD wScrollPos )
|
Remarks
|
Scrolls TTY window horizontally.
|
Function
|
SetTTYFocus
|
Include file
|
TDF_TTY.H
|
Prototype
|
BOOL NEAR SetTTYFocus( HWND hWnd )
|
Remarks
|
Sets the focus to the TTY window also creates caret.
|
Function
|
KillTTYFocus
|
Include file
|
TDF_TTY.H
|
Prototype
|
BOOL NEAR KillTTYFocus( HWND hWnd )
|
Remarks
|
Kills TTY focus and destroys the caret.
|
Function
|
MoveTTYCursor
|
Include file
|
TDF_TTY.H
|
Prototype
|
BOOL NEAR MoveTTYCursor( HWND hWnd )
|
Remarks
|
Moves caret to current position.
|
Function
|
ProcessTTYCharacter
|
Include file
|
TDF_TTY.H
|
Prototype
|
BOOL NEAR ProcessTTYCharacter( HWND hWnd, BYTE bOut )
|
Remarks
|
This simply writes a character to the port and echos it to the TTY
screen if fLocalEcho is set.
|
Function
|
OpenConnection
|
Include file
|
TDF_TTY.H
|
Prototype
|
BOOL NEAR OpenConnection( HWND hWnd )
|
Remarks
|
Opens communication port specified in the TTYINFO struct. It also sets the
CommState and notifies the window via the fConnected flag in the TTYINFO struct.
|
Function
|
SetupConnection
|
Include file
|
TDF_TTY.H
|
Prototype
|
BOOL NEAR SetupConnection( HWND hWnd )
|
Remarks
|
This routines sets up the DCB based on settings in the TTY info structure
and performs a SetCommState().
|
Function
|
CloseConnection
|
Include file
|
TDF_TTY.H
|
Prototype
|
BOOL NEAR CloseConnection( HWND hWnd )
|
Remarks
|
Closes the connection to the port. Resets the connect flag in the TTYINFO
struct.
|
Function
|
ReadCommBlock
|
Include file
|
TDF_TTY.H
|
Prototype
|
int NEAR ReadCommBlock( HWND hWnd, LPSTR lpszBlock, int nMaxLength )
|
Remarks
|
Reads a block from the COM port and stuffs it into the provided buffer.
|
Function
|
WriteCommBlock
|
Include file
|
TDF_TTY.H
|
Prototype
|
BOOL NEAR WriteCommBlock( HWND hWnd, LPSTR lpByte , DWORD dwBytesToWrite)
|
Remarks
|
Writes a block of data to the COM port specified in the associated
TTY info structure.
|
Function
|
WriteTTYBlock
|
Include file
|
TDF_TTY.H
|
Prototype
|
BOOL NEAR WriteTTYBlock( HWND hWnd, LPSTR lpBlock, int nLength )
|
Remarks
|
Writes block to TTY screen. Nothing fancy - just straight TTY.
|
Function
|
GoModalDialogBoxParam
|
Include file
|
TDF_TTY.H
|
Prototype
|
VOID NEAR GoModalDialogBoxParam( HINSTANCE hInstance, LPCSTR lpszTemplate,
HWND hWnd, DLGPROC lpDlgProc, LPARAM lParam )
|
Remarks
|
It is a simple utility function that simply performs the MPI and invokes the
dialog box with a DWORD paramter.
|
Function
|
AboutDlgProc
|
Include file
|
TDF_TTY.H
|
Prototype
|
BOOL FAR PASCAL AboutDlgProc( HWND hDlg, UINT uMsg,
WPARAM wParam, LPARAM lParam )
|
Remarks
|
A simple dialog box proc to support an "about" box.
|
Function
|
FillComboBox
|
Include file
|
TDF_TTY.H
|
Prototype
|
VOID NEAR FillComboBox( HINSTANCE hInstance, HWND hCtrlWnd, int nIDString,
DWORD NEAR *npTable, WORD wTableLen,
DWORD dwCurrentSetting )
|
Remarks
|
Fills the given combo box with strings from the resource table starting at
nIDString. Associated items are added from given table. The combo box is
notified of the current setting.
|
Function
|
SettingsDlgInit
|
Include file
|
TDF_TTY.H
|
Prototype
|
BOOL NEAR SettingsDlgInit( HWND hDlg )
|
Remarks
|
Puts current settings into dialog box (via CheckRadioButton() etc.)
|
Function
|
SelectTTYFont
|
Include file
|
TDF_TTY.H
|
Prototype
|
BOOL NEAR SelectTTYFont( HWND hDlg )
|
Remarks
|
Selects the current font for the TTY screen. Uses the Common Dialog
ChooseFont() API.
|
Function
|
SettingsDlgTerm
|
Include file
|
TDF_TTY.H
|
Prototype
|
BOOL NEAR SettingsDlgTerm( HWND hDlg )
|
Remarks
|
Puts dialog contents into the TTY info structure.
|
Function
|
SettingsDlgProc
|
Include file
|
TDF_TTY.H
|
Prototype
|
BOOL FAR PASCAL SettingsDlgProc( HWND hDlg, UINT uMsg,
WPARAM wParam, LPARAM lParam )
|
Remarks
|
Dialog Proc for setting all of the user preference settings for the TTY.
|
Function
|
CommWatchProc
|
Include file
|
TDF_TTY.H
|
Prototype
|
DWORD FAR PASCAL CommWatchProc( LPSTR lpData )
|
Remarks
|
A secondary thread that will watch for COMM events.
|
Function
|
snarf_the_bytes
|
Include file
|
TDF_TTY.H
|
Prototype
|
void snarf_the_bytes( LPSTR lpBlock, int nLength )
|
Remarks
|
Copy the ASCII data, NUKK terminate it then pass it to the store code.
|
Function
|
init_the_snarf_code
|
Include file
|
TDF_TTY.H
|
Prototype
|
void init_the_snarf_code( void )
|
Remarks
|
Clear the signal data collection vars.
|
Function
|
write_snarfed_data
|
Include file
|
TDF_TTY.H
|
Prototype
|
void write_snarfed_data( void )
|
Remarks
|
If the collection tree is dirty flush it to disk.
|
Function
|
init_1_broadcast_port
|
Include file
|
TDF_TTY.H
|
Prototype
|
IP_SOCK *init_1_broadcast_port( int port_num )
|
Remarks
|
Allocate, initialize, open and return to the caller a UDP broadcast socket
for his requested port number.
|
Function
|
init_broadcast_ports
|
Include file
|
TDF_TTY.H
|
Prototype
|
void init_broadcast_ports( void )
|
Remarks
|
Open all the broadcast ports for the application. (4 - raw data echo,
data quotes, market messages and time stamps.)
|
Function
|
free_the_snarf_code
|
Include file
|
TDF_TTY.H
|
Prototype
|
void free_the_snarf_code( void )
|
Remarks
|
Be nice and close the sockets before exiting.
|
Function
|
process_cmd_line_4_arguments
|
Include file
|
TDF_TTY.H
|
Prototype
|
void process_cmd_line_4_arguments( void )
|
Remarks
|
Process the user's command line arguments into a argv array which then is
processed by the normal getargs() procedure to store the data into the
programs switch flags.
|
Table of Contents
Function Index
ttywnd_r.c - TTY WiNDow Routines
Function
|
alloc_ttywin
|
Include file
|
TTYWND_R.H
|
Prototype
|
TTYWIN * alloc_ttywin( void )
|
Remarks
|
Allocate and initialize a ttywin struct.
|
Function
|
regTTYWinClass
|
Include file
|
TTYWND_R.H
|
Prototype
|
ATOM regTTYWinClass( TTYWIN *tw_ptr )
|
Remarks
|
Register a ttywnd class object with Window32.
|
Function
|
updateTTYWin
|
Include file
|
TTYWND_R.H
|
Prototype
|
void updateTTYWin( TTYWIN *tw_ptr , LPSTR data_str )
|
Remarks
|
Write the data_str into the circular buffer then tell the WndProc to
with a WM_UPDATE msg.
|
Function
|
loadTTYWin
|
Include file
|
TTYWND_R.H
|
Prototype
|
HWND loadTTYWin(
TTYWIN *tw_ptr , LPSTR file_to_load , LPSTR window_title , int delete_file )
|
Remarks
|
Create and load a tty win with text from a file. If delete_flag is set then
the file will be deleted on window close (so you can forget about deleting
the temp file).
|
Function
|
localTTYWndProc
|
Include file
|
TTYWND_R.H
|
Prototype
|
LONG WINAPI localTTYWndProc( HWND hWnd , UINT messg ,
UINT wParam , LONG lParam )
|
Remarks
|
This is sample WndProc hook code.
This hook should be defined outside of the dll library code in the program
main for user supported msgs. It is not required - by default TTYWndProc()
is used.
|
Function
|
TTYWndPaint
|
Include file
|
TTYWND_R.H
|
Prototype
|
static void TTYWndPaint( HWND hWnd , HDC hdc )
|
Remarks
|
This routine is the paint routine for the main TTYWndProc. It handles
repaints for both FILE & TTY style windows.
|
Function
|
TTYWndProc
|
Include file
|
TTYWND_R.H
|
Prototype
|
LONG TTYWndProc(
HWND hWnd , UINT messg , UINT wParam , LONG lParam )
|
Remarks
|
The main WndProc for the TTYWIN.
|
Function
|
get_lines_in_file
|
Include file
|
TTYWND_R.H
|
Prototype
|
static int get_lines_in_file( TTYWIN *tw_ptr )
|
Remarks
|
A simple count the lines in the target file routine.
|
Function
|
get_free_window_slot
|
Include file
|
TTYWND_R.H
|
Prototype
|
static int get_free_window_slot( void )
|
Remarks
|
|
Function
|
find_ttywin_ptr
|
Include file
|
TTYWND_R.H
|
Prototype
|
TTYWIN *find_ttywin_ptr( HWND hwnd )
|
Remarks
|
|
Function
|
set_favorite_ttywin_config
|
Include file
|
TTYWND_R.H
|
Prototype
|
void set_favorite_ttywin_config( TTYWIN *tw_ptr )
|
Remarks
|
Set the passed in TTYWIN ptr to the current module defaults.
|
Function
|
set_ttywin_defaults
|
Include file
|
TTYWND_R.H
|
Prototype
|
void set_ttywin_defaults( int width , int height , int font )
|
Remarks
|
Set the module defaults for TTYWIN's.
|
Table of Contents
Function Index
uoutport.c - Udp OUTput PORT routines
This code supports write operations for the UDP port subsystem. It supports
simple UDP broadcasting on a LAN so you can do client/server dialoging &
message passing.
This is standard UNIX code from Stevens ported to Windows.
Function
|
init_to_broadcast_on_port
|
Include file
|
UOUTPORT.H
|
Prototype
|
int init_to_broadcast_on_port(
IP_SOCK *u_ptr , UWORD port_num )
|
Remarks
|
Initialize a UDP socket for broadcast.
|
Function
|
send_string
|
Include file
|
UOUTPORT.H
|
Prototype
|
int send_string( IP_SOCK *u_ptr , char *stringPtr )
|
Remarks
|
Write an normal C terminated string out a UDP socket.
|
Table of Contents
Function Index
u_inport.c - Udp INput PORT routines
This code supports read operations for the UDP port subsystem.
This is standard UNIX code from Stevens ported to Windows.
Function
|
init_to_receive_on_port
|
Include file
|
U_INPORT.H
|
Prototype
|
int init_to_receive_on_port(
IP_SOCK *u_ptr , UWORD port_num , int is_blocking )
|
Remarks
|
Initialize and open up a UDP port for reading. You can also
set the port for blocking or non-blocking IO on the port.
|
Function
|
getchar_from_UDP_packet
|
Include file
|
U_INPORT.H
|
Prototype
|
int getchar_from_UDP_packet( IP_SOCK *u_ptr )
|
Remarks
|
Return the next byte from a UDP datagram buffer. If the socket
is empty this routine will first do a receive_datagram() on the port
to load the datagram.
|
Table of Contents
Function Index
wlogger.c - Windows udp LOGGER
A very useful little utility. It will listen to a udp port and log
everything seen to a scrolling TTY window.
Function
|
localTTYWndProc
|
Include file
|
WLOGGER.H
|
Prototype
|
LONG WINAPI localTTYWndProc( HWND hWnd , UINT messg ,
UINT wParam , LONG lParam ) ;
|
Remarks
|
|
Function
|
WinMain
|
Include file
|
WLOGGER.H
|
Prototype
|
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow )
|
Remarks
|
Program entry point.
|
Function
|
InitApplication
|
Include file
|
WLOGGER.H
|
Prototype
|
BOOL InitApplication( HANDLE hInstance )
|
Remarks
|
First time initialization stuff.
|
Function
|
InitInstance
|
Include file
|
WLOGGER.H
|
Prototype
|
HWND InitInstance( HANDLE hInstance, int nCmdShow )
|
Remarks
|
Initializes instance specific information.
|
Function
|
process_cmd_line_4_arguments
|
Include file
|
WLOGGER.H
|
Prototype
|
void process_cmd_line_4_arguments( void )
|
Remarks
|
Process the user's command line arguments into a argv array which then is
processed by the normal getargs() procedure to store the data into the
programs switch flags.
|
Function
|
local_exit
|
Include file
|
WLOGGER.H
|
Prototype
|
void local_exit( int exit_code )
|
Remarks
|
|
Function
|
init_1_broadcast_port
|
Include file
|
WLOGGER.H
|
Prototype
|
IP_SOCK *init_1_broadcast_port( int port_num )
|
Remarks
|
Allocate, initialize, open and return a UDP broadcast socket for the user's port.
|
Function
|
init_broadcast_ports
|
Include file
|
WLOGGER.H
|
Prototype
|
void init_broadcast_ports( void )
|
Remarks
|
Open the app's broadcast ports.
|
Function
|
udp_thread
|
Include file
|
WLOGGER.H
|
Prototype
|
void udp_thread( PVOID pvoid )
|
Remarks
|
Startup a separate thread to handle listening for new incoming data and
painting to the window.
|
Function
|
localTTYWndProc
|
Include file
|
WLOGGER.H
|
Prototype
|
LONG WINAPI localTTYWndProc( HWND hWnd , UINT messg ,
UINT wParam , LONG lParam )
|
Remarks
|
Local TTYWndProc to handle app command processing.
|
Table of Contents
Function Index
win_app.c - A simple Windows app shell
A nice shell to use as a hack & slash starting point for building
a windows app.
Function
|
WinMain
|
Include file
|
WIN_APP.H
|
Prototype
|
int WINAPI WinMain( HINSTANCE hInstance , HINSTANCE hPrevInstance ,
LPSTR lpCmdLine , int nCmdShow )
|
Remarks
|
Main windows entry point.
|
Function
|
update_library_global_vars
|
Include file
|
WIN_APP.H
|
Prototype
|
void update_library_global_vars( void )
|
Remarks
|
Update the TDF_lib global vars with data from the user's command line.
|
Function
|
print_usage
|
Include file
|
WIN_APP.H
|
Prototype
|
void print_usage( void )
|
Remarks
|
Print a usage message to the user.
|
Function
|
process_cmd_line_4_arguments
|
Include file
|
WIN_APP.H
|
Prototype
|
void process_cmd_line_4_arguments( void )
|
Remarks
|
Process the user's command line arguments into a argv array which then is
processed by the normal getargs() procedure to store the data into the
programs switch flags.
|
Function
|
control_c_handler
|
Include file
|
WIN_APP.H
|
Prototype
|
BOOL WINAPI control_c_handler( DWORD dwCtrlType )
|
Remarks
|
A simple control-c handler.
|
Function
|
localQSWndProc
|
Include file
|
WIN_APP.H
|
Prototype
|
LONG WINAPI localQSWndProc(
HWND hWnd , UINT mesg , UINT wParam , LONG lParam )
|
Remarks
|
Local WndProc for keyboard command handling.
|
Table of Contents
Function Index
cons_app.c - A simple console app
A nice shell to use as a hack & slash starting point for building
a console app.
Function
|
main
|
Include file
|
CONS_APP.H
|
Prototype
|
void main( int argc , char *argv[] )
|
Remarks
|
DOS/C style main() entry point.
|
Function
|
update_library_global_vars
|
Include file
|
CONS_APP.H
|
Prototype
|
void update_library_global_vars( void )
|
Remarks
|
Update the TDF_lib global vars with data from the user's command line.
|
Function
|
print_usage
|
Include file
|
CONS_APP.H
|
Prototype
|
void print_usage( void )
|
Remarks
|
Print a usage message to the user.
|
Function
|
control_c_handler
|
Include file
|
CONS_APP.H
|
Prototype
|
BOOL WINAPI control_c_handler( DWORD dwCtrlType )
|
Remarks
|
A simple control-c handler.
|
Table of Contents
Function Index
Function Index
Go to Table of Contents
|