ESPL Editor

Prior | Next

To display the ESPL Editor window, click the ESPL button on the main Toolbar, or select File | Open | ESPL Editor from the menu. T he ESPL Editor is used to write ESPL programs (scripts).  The Editor window is divided into two halves.  The left half is used to enter the programming code for the ESPL program.  The right half is an Output window that can be used to output results of the ESPL program if necessary.  The Write and Writeln statements are used to print text in the Output window.  Several buttons and tabs are used to open, and save files, as well as run programs, clear the Output window, and switch to other ESPL programs. T he Editor will remember and restore the last window position, splitter bar position, and ESPL file that was loaded each time the Editor window is displayed.

New, Open, and Save Buttons
These three buttons have typical Windows behavior. The New button will load the Default.spt script file. This is a convenient shell for starting a new program. You can save something else to Default.spt if you would prefer a different default script.

Cut, Copy, and Paste Buttons
The cut, copy, and paste buttons can be used to cut, copy, or paste ESPL programming code. Text from the Output window can also be cut, copied, or pasted. Highlight the desired text with the mouse before using the copy or cut functions. Locate the cursor to the desired insert location before pasting.

Help
Click the Help button to open the ESPL help file. Use the index to find a read documentation on ESPL commands and syntax.

Clear Output Window Button
This button will erase the contents of the Output window on the right side.

Timer Button
Some scripts are designed to run at regular intervals. The Stop Watch button is used to start the Timer which will repeatedly execute the script at a timed interval. Use the menu item ESPL | Timer Interval to set the number of seconds in the interval. Running the timer automatically minimizes the Editor window.

Run Button
Click this button to set the ESPL variable to zero and execute the script. The keyboard control key for the Run button is Alt-0. The script from the Editor window is compiled and executed. Error messages are displayed if the script contains syntax errors that keep the script from compiling. Once the script has been compiled, it may be possible to close the Editor, depending on whether or not your script uses the Output window or the Watch window. Also, the Editor window can be minimized. 

Buttons 1-9
The ESPL variable will be set to a value of 1 through 9, and the appropriate script executed, by clicking on the numbered buttons 1 through 9 on the Editor’s button panel. 

Chart Pop-Up Menu Who 1-9
Programs can be run and the by right-clicking on a chart. A pop-up menu will appear. Select Run ESPL from the menu to display the ESPL Run window.

Results
The 'Results' button is used to view a trading log of a trading system that was just run. The button will not respond if a trading system program is not run first.

Editing (Check Box)
Whenever you are editing an ESPL script, the 'Editing' check box appears. Any ESPL programs that are currently running are paused. Uncheck the 'Editing' box when you are finished editing to resume the ESPL programs. Errors would occur if the ESPL process were running while you were making changes and additions to the script.

Variable Watch [Ctrl-W]
Debugging is greatly aided by being able to observe the variable values. Press Ctrl-W to toggle on or off the display of the variable Watch window. Symbols are added to the table by using the Watchstatement in your script. The variable Watch window is a useful table where you may display your results instead of writing to the Output workspace.

Splitter Bar
The Editor and Output windows, by default, are split vertically. They are separated by a splitter bar that can be dragged left or right to change the window sizes. Use the menu item Script | Split Vertical to change the split between vertical and horizontal.

Tabs
Tabs at the bottom of the Script Editor window are used to switch to other ESPL files. This is the same as clicking the Open button and then selecting a new file to open.  There will be one tab for each script file found in the C:\Ensign\Macro folder.  Clicking a tab is a super quick way to save the current script, and load the script on the tab.   This is equivalent to using the open dialog box to load a script.

Associated with the script editor is the ESPL engine.   The engine will compile and execute the loaded script.   Once the script is compiled by running it once, the script editor could be closed and the engine will still hold the last compiled script.   If you need a new script or need to make changes, the script editor would be reopened and the script loaded or modified.   When the script is executed, it is recompiled and held by the ESPL engine.

Charts may contain a study that the current script does not service.  I can't prevent that.  You just have to use scripts that are appropriate for the way you use them.   If the script is not present that correctly services the study, usually nothing happens and you just don't get the study.   The study is setting a value in the ESPL variable and calling the ESPL engine.   There is not a name association between the study and any particular script file.   All studies, tools, and ESPL color bars you need should be grouped in one script.

Modified scripts are resaved when you select another script, or try to close the script editor.

Prior | Next