UA scans the UA directory for "study*.ini" files. Each .ini file has a corresponding DLL. When UA runs a study, it creates an indata file. UA calls the study function in the studyXXX.dll. UA reads the outdata file, and plots the results.
A field specifier is a character. r1 is the immediate series. If there is an overlayed graph, then a second series r2 may be present:
case 'o': v = r1->open ; break;
case 'h': v = r1->high ; break;
case 'l': v = r1->low ; break;
case 'c': v = r1->close; break;
case 'v': v = r1->vol ; break;
case 'V': v = r1->tvol ; break;
case 'i': v = r1->oi ; break;
case 'I': v = r1->toi ; break;
case '$': v = r1->cash ; break;
case 'O': v = r2->open; break;
case 'H': v = r2->high; break;
case 'L': v = r2->low ; break;
case 'C': v = r2->close; break;
case 'w': v = r2->vol ; break;
case 'W': v = r2->tvol ; break;
case 'p': v = r2->oi ; break;
case 'P': v = r2->toi ; break;
case 'S': v = r2->cash ; break;
The StudyXXX.Ini file
UA looks for the following fields in the Ini file.
"study","DESCRIPTION" The selection description
"study","CHARTLABEL" The charting abbreviation
"study","Inputs" A string formed from Field Specifiers
"study","Outputs" A string formed from Field Specifiers
"study","MIN" The minimum value attainable (Adjusted if data violates)
"study","MAX" The maximum value attainable (Adjusted if data violates)
"study","SharePriceScale" Use a value of 1 if the return is in price units or zero if not.
"study","MinimumNumDays" The user gets a warning if the number of data days is insufficient.
"study","NUMPARMS" How many parameters the study has (currently limited to 4)
For each parameter, UA looks for a section "parmX" where X is the parameter index (1-4).
parmX,"LABEL" Parameter Label
parmX,"CONTROL" Parameter Control type (EDIT or CHECK)
parmX,"DEFAULT" Default Value (TRUE=1, FALSE=0)
parmX,"TYPE" Parameter Type (INT or FLOAT)
A file name "indata" in the UA directory is created to provide the data for the study. This file is in a space-seperated format. Suppose that the study is listed to have m inputs. The first line of the indata file contains the conversion factors for each of these inputs. The remaining lines begin with the date and then each of the inputs for that date on that line.
The StudyXXX.dll file
Currently all DLL's must be 16-bit dlls. The studyXXX.dll must export
int FAR PASCAL Study( long *argc, long *Iparm, float *Fparm);
The arguments are defined as to be
Where argc is
argc = InDataCount; (Number of data records in indata)
argc = Inputs.GetLength(); (Number of parameters based on the ini file)
argc = Outputs.GetLength(); (Number of outputs base on the ini file)
argc = Number of Integer parameters
argc = Number of Float parameters
FParm and Iparm contain the parameter values.
The outdata file
The study should write its results to the file "outdata" in the UA directory. This file has the same format as the indata file.
To refresh study
As you are developing your study, you may notice that everytime you go to choose a study, it has reread the directory. Everytime it runs a study, it is reopening the dll.
The following syntax should be used to provide default settings and understandable menu selections:
'example MAOfClose(5) = 5-day mov avg of close (for VisualBasic)
#example Stoc(5,3,3) = 5/3/3-day Stochastic (for Perl)
The following functions are common all modes:
getNumDays, getOpen, getHigh, getLow, getClose, getVolume, getOpenInterest,
O, H, L, C, and V
When writing indicators in Perl, the column headings/crosshairs titles are specified by the programmer using the UAIndicatorLabels variable. We have tried to use all of the major variables and keywords in the examples provided.
For more information about the languages, you must look at the documentation for the languages themselves. Visual Basic Script, for example, is documented in a set of HTML files conveniently provided in the file vbsdoc.exe in the Scripting directory on the installation disk. When executed, this setup installs an HTML document defining Visual Basic Script.
Click this link for more examples.
Click here to learn more about Study Input.