EFS Execution in a Watch List

ICE Data Services -

EFS Execution in a Watch List

Introduction to EFS


EFS Scripts are allowed to be executed in Watch Lists starting with version 11. This article describes the principal differences in the way the scripts are processed in Watch Lists and Charts.

 

Preparation steps

The application of EFS Script forces Watch Lists to perform some preparation steps. During these steps preMain() functions are executed twice to determine number of columns, their names, script parameters and assigned defaults.

The number of columns for the script corresponds to the number of setCursorLableName() functions specified in preMain().  The following script will create 1 column:

function preMain() {}
function main() {
  return new Array(1, 2);
}

This script sample will create 2 columns:

function preMain() {
  setCursorLabelName("First Column", 0);
  setCursorLabelName("Second Column", 1);
}
function main() {
  return;
}

The data format can be specified for each column. It can be done using special controls in the Edit Columns dialog, which have the following options:

   ·    Price 
   ·    Volume 
   ·    2 digits after the point 
   ·    3 digits after the point 
   ·    4 digits after the point 


EFS scripts applied to Watch Lists can specify the default data format (for all columns) using setPriceStudy() function. If it is set as true the outputs type will be set as "Price", otherwise it will be set as "2 digits after the point".

 

Script execution

Generally, EFS scripts that are designed to be used in Watch Lists consists of the parts outlined in this article similar to EFS scripts for Charts. The main difference is that Watch Lists only displays the last value of the return series, while Charts have an ability to historical values as well as drawn objects.

If any sections of script logic needs to be executed only in Watch Lists, the isWatchList() function can be used to identify the window type where the script is executing.

For the eSignal 11 series, EFS calculations are based on the most recent 50 bars of data by default.  Starting with version 11.3, the amount of bars can be adjusted using custom Time Templates. The interval can also be specified for each EFS script.  The default is daily.  For scripts running in a Watch List and a Chart simultaneously, t he number of bars as determined by the time template and the specified interval need to be the same in order for the current values to be calculated on the same data sets.  If the time template and interval used are different, the result can generate differences in values between these two window types.  

The script execution stages are displayed in the upper left corner of the cell for each symbol. The following status colors are shown during the loading process:

   ·    pending session request... - grey square in the upper left corner of the cell 
   ·    creating session... - yellow  
   ·    pending calculation request... - blue 
   ·    calculating script.../study... - green 
   ·    requesting session error... - red  


Watch Lists create an EFS instance for each symbol in window.  These instances can be created and deleted several times.  In Watch Lists there are some unique behaviors for EFS execution:

   ·    Reloading EFS causes deletion and creation of each EFS instance for each symbol. 
   ·    In Watch Lists, a new instance will be created for each hibernated symbol to populate initial values for columns and then it will be deleted. 
   ·    When symbols fall into hibernation mode, the Watch List deletes each EFS instance while leaving the last calculated value displayed in the EFS columns. 
   ·    An EFS instance will be created to recalculate columns values and then deleted after that every 5 minutes for hibernated symbol. 

 

Hibernation

Watch Lists have a very important hibernation functionality. Hibernation is aimed to save resources when symbols are not in use (in view).  Every time a symbol is hibernated, its current EFS instance is deleted, which causes the postMain() function to be executed.

Starting with 11.4 the hibernation feature can be disabled using the appropriate option "Hibernation Mode" in the Watch List menu.  If the script execution need to remain continuous, simply disable hibernation.  This will also prevent postMain() from executing until the script is removed from the Watch List.  

 

Restrictions

Because of the inherent differences between Watch Lists and Charts, there are some functions will be ignored when executing in Watch Lists:

· drawing functions 
· debug methods [debugClear(), debugPrint(), debugPrintln()
· alert object methods (email() not supported in 11.4 and earlier versions)
· askForInput()