Navigation: Introduction > Objects and Concepts

Objects and Concepts

Top  Previous  Next

Objects

 

The ScanExpert scripting language is based primarily on objects:

 

Stream Object: A Stream object of type TEStream is created by ScanExpert to manage data flow for almost all information that flows into, or out of, the ScanExpert program and, as such, the Stream object is the most important object in the system. All symbol price information (i.e., open, high, low, close, volume, etc.) is stored in Stream objects and the input as well as the output of all study formulas is stored in Stream objects. Each Stream object (and there can be thousands of them in a large grid) has a small in-memory program attached to it (a bot) that keeps the Stream object updated at all times. The Stream object methods, as well as the related Stream Utility Functions, are used heavily in study formula development and they are described in the Stream Functions section of the Function Reference.

 

Grid Object: The Grid object is an interface between the user script and the ScanExpert Viewer Grid and you use this object to pass information from the script back to the grid for display. The Grid object has several methods and these are described in the User Script Functions section of the Function Reference. The Grid object is used almost exclusively in user scripts and only has a small part to play in study formula development.

 

Symbol Object: The Symbol object provides access to information relating to any and all symbols that are being processed in the ScanExpert system when the grid is running. The object methods associated with the Symbol object are used primarily in user scripts and very rarely in study formulas. The Symbol object methods are described in the User Script Functions section of the Function Reference.

 

Study Object: A Study object of type TEStudy is created by ScanExpert for each study formula defined in the system and is used to pass information between ScanExpert and the study formulas and vice versa. The Study object is used to gain access to the input streams and input parameters that a study formula needs for its calculations, and it is used to pass calculated values back to ScanExpert for storage in a Stream object. A system global variable called ThisStudy provides direct access to the Study object associated with any study formula that you work with. The Study object methods are described in the Study Formula Functions section of the Function Reference.

 

 

Files and Folders

 

When developing study formulas you will be making use of files in the Studies folder in the ScanExpert data directory on your hard drive. The ScanExpert data directory will be found under My Documents.

 

All of the built-in study formulas have a file prefix of "ds" for Divergence Software. It is recommended that you come up with a unique prefix for any custom study formulas that you develop. In practice, do not edit any of the built-in study formulas. Instead make a copy under a different name (with your unique prefix).

 

There are 4 study formula configuration files that you will need to become familiar with before you can implement any new custom study formulas. All of these can be found in the Studies folder referenced above.

 

functionsSystem.pas: This file contains the study declarations for all of the built-in study formulas. This is the file that ScanExpert reads to determine what built-in studies exist and where they are located. If you review this file you will see that many of the built-in studies are actually fully implemented in this configuration file (i.e., they do not have a separate source code file in the Studies folder). This is an important concept with very low overhead (i.e., deriving new studies from existing studies) and you should make use of this feature as much as possible when implementing your own study formulas. Below is a code snippet from the functionsSystem.pas configuration file.

 

Note: You should never edit or otherwise change this file. However you should review it, even print it out, so you can use it as a reference when you work with the functionsUser.pas configuration file.

 

 

functionsSystem1

 

You can see that the "friendly" study formula names are declared in this file. These are the study names that you see in the Wizard as well as in any scripts generated by the Wizard. The actual study formula source files (i.e., the Pascal source files that contain the study logic) are, in turn, called by the functions declared in the functionsSystem.pas file. You can also see some Category definitions in the code snippet above. These Category definitions are used by the Wizard to create the various study formulas sections that you see in the Wizard Study Selection box.

 

functionsUser.pas: This is the user equivalent of the functionsSystem.pas configuration file and this is one of the two configuration files that you will edit when you create new study formulas. ScanExpert will read this file and will load any and all custom study formulas declared in this file. Initially the functionsUser.pas file is empty. When you develop new study formulas you will declare them in the functionsUser.pas file in exactly the same fashion as the built-in studies are declared in the functionsSystem.pas file so you can use that file as a template.

 

studyInfoSystem.txt: This text file contains parameter and usage information for all of the built-in study formulas. It is a simple text file format and can be loaded into any text editor. As with the functionsSystem.pas file, you should not edit or otherwise change this file but you can use it as a reference when you work with the studyInfoUser.txt file, which is where all parameter and usage information for custom study formulas should be stored. Below is a snippet from the studyInfoSystem.txt file.

 

studyInfoSystem1

 

studyInfoUser.txt: This is the user equivalent of the studyInfoSystem.txt file and this is one of the two configuration files that you will edit when you create new study formulas. Adding parameter and usage information to the studyInfoUser.txt file is optional but is highly recommended. Initially the studyInfoUser.txt file is empty.

 

 

Note: Never edit any of the system configuration files (i.e., functionsSystem.pas or studyInfoSystem.txt). Instead print them out for reference.