| Basics of ESPL |
June 28 , 2006
16:30 Ensign Kimball: Welcome to the Wednesday Ensign Class.
16:31 Ensign Kimball: Today's class instruction will cover some ESPL programming topics.
16:31 Ensign Kimball: The Ensign Software Programming Language (ESPL) is a customized programming language developed specifically for Ensign Windows. The ESPL language allows users to program custom studies, tools, and reports, as well as perform countless other tasks. The ESPL language has a high learning curve. However, it is very powerful
16:32 Ensign Kimball: To begin an ESPL program, click the ESPL button and open the ESPL Editor window

16:32 Ensign Kimball: The LEFT side of the window is used to type programming code. The RIGHT side of the window is an Output area, where you can print reports or results of your programming. All ESPL programs must have a BEGIN and END statement that block out the main programming code

16:34 Ensign Kimball: A simple 3 line program is shown above. The 'writeln' command prints text to the Output window.

16:35 Ensign Kimball: Adding some additional programming code cause more printing in the Output window. Click the 'Run' button in the ESPL editor window to run this code
16:36 Ensign Kimball: To access a CHART, use the 'FindWindow' command first to locate the opened window. If I open an IBM daily chart, I can then access items on the chart by doing the following.

16:37 Ensign Kimball: The FindWindow command found the open chart, then the 'writeln' command printed the LAST (closing) price for the last bar on the chart.
16:38 Ensign Kimball: To SAVE an ESPL program, click the SAVE button in the ESPL editor.
16:38 Ensign Kimball: A Save File dialog box will open and allow you to type a filename. The files are normally saved in the \ENSIGN\ESPL folder on your computer. Only 1 ESPL file can be open at one time. If you need to write multiple ESPL tasks and access them all at the same time, then just write all the tasks in the same ESPL programming file.
16:40 Ensign Kimball: This is done by grouping program into PROCEDURES. I will show an example. The code above code be separated out of the Main program code, and placed into a procedure (which is called from the Main program)

16:41 Ensign Kimball: I copied the 2 lines of code and placed them in a new PROCEDURE named 'PrintLastBar'. You could name it whatever you like. The MAIN programming code at the bottom now has some code to CALL the procedure whenever you click ESPL button 1.

16:44 Ensign Kimball: The Procedures must be located ABOVE the MAIN program at the bottom
16:44 Ensign Kimball: The code has now been expanded to include a 2nd Procedure named 'HelloFriends'. The 'HelloFriends' code is run whenever you click ESPL button 2. The output window shows the results of my having Clicked ESPL button 1, then ESPL button 2.

16:46 Ensign Kimball: I have now expanded the logic in the 'PrintLastBar' routine. It will print the Last, High, Open, and Low prices for the 5th bar from the end of the chart (BarEnd - 5). I could add some labels and formatting to the prices by doing the following.

16:48 Ensign Kimball: I have typed in some TEXT labels in the 'writeln' statements that label what the prices are. I have also inserted the 'FormatPrice' command to output the prices in a nicer format.
16:49 Ensign Kimball: Next...lets plot some lines on the IBM daily chart. I will add another procedure to the ESPL code.

16:52 Ensign Kimball: I have added a new Procedure named 'HighLow' that plots 2 lines that connects all the HIGHS and LOWS on the chart. The Procedure is run by clicking ESPL button 51. The ESPL 51 button in not displayed in the ESPL editor window. This button is found by clicking on the RUN button on the CHART toolbar

16:53 Ensign Kimball: In summary, you must do the following.
16:53 Ensign Kimball: 1) Open a chart (I opened an IBM Daily chart)
16:54 Ensign Kimball: 2) Make sure that your ESPL programming code has been loaded or typed into the ESPL Editor window
16:54 Ensign Kimball: 3) Click the ESPL 51 button to run the Procedure
16:54 Ensign Kimball: The procedure code has a FOR loop that loops through all the bars on the chart from BARBEGIN to BAREND and plots 2 lines connecting the HIGHS and LOWS on the chart.

16:55 Ensign Kimball: I programmed the HIGH line to be RED, and the LOW line to be Green (lime). We now have 3 small ESPL programs that we can save in this ESPL program file. They are run by clicking ESPL button 1, ESPL button 2, and ESPL button 51.
16:57 Ensign Kimball: The ESPL programming language has over 300 different programming commands. There is an on-line ESPL manual that you can access on the Ensign web site. There are programming example for each command. There are a lot of ESPL program samples.
16:57 Ensign Kimball: .
16:58 Ensign Kimball: We realize that the ESPL language is hard....and is not for everyone. However, the power that ESPL provides is pretty amazing. We could spend an entire week teaching the concepts of ESPL programming. This has been just a glimpse. Hopefully it can expand your awareness a little of what is available to you in Ensign Windows.
17:00 Ensign Kimball: ESPL can be used to program full blown trading systems, studies, lines on chart, alerts, file processing, news and quote page functions, reports of all kinds, complex User defined symbols, plotting of all the markers, scanning of all the symbols. The code can also be encrypted so that others cannot see your programmind code
17:03 Ensign Kimball: If you are not interested in ESPL programming, but have a complicated system that you would like to implement in Ensign Windows, then you can have someone program it for you. There are some Ensign staff, and some expert customer programmers who will accept programming tasks for a fee. The fee just depends on what needs to be done.
17:04 Ensign Kimball: .
17:05 Ensign Kimball: The 'Design Your Own' (DYO) study was implemented to provide some of the tasks that ESPL can do, to someone who is not of a programmers mentality. The DYO studies can do a lot. But, for very complex studies and ideas, ESPL is still the way to go.
16:55 dbquik: Could you explain why the different types of run buttons?
Different types of button run the script in different ways. 1-9 just go through once from start to end -- good for backtests. Have to use 51-59 for studies that re-run the program again for each bar on the chart, then again each time a new bar ends
www.ensignsoftware.com/espldoc/using_the_espl_global_variable_and_running_espl_programs.htm
17:07 Ensign Kimball: The best way to learn ESPL is to view some ESPL programming that is already done.
17:07 Ensign Kimball: Thanks for coming to the class today. I hope that you week goes well.
17:07 @Buffy: thank you Kimball -- same to you
17:07 Ensign Kimball: if you have questions regarding ESPL you can send them to me at Kimballh@ensignsoftware.com
17:08 Ensign Kimball: Have a nice day.