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
generated on 22 September 1998 - 12:55:35
© 1998 Tierra del Fuego Ltd.
|