ESPL Sending Email

June 13 , 2007

17:06 Ensign Howard: The next training topic will be in using ESPL to send an e-mail in response to some kind of an alert.

 

17:07 Ensign Howard: ESPL has a powerful feature in a statement to send an e-mail.

17:07 Ensign Howard: The statement is Email( ..... ) with a list of parameters.

17:08 Ensign Howard: The first parameter is the Subject text, and in the example is this the string 'Alert Text'

17:08 Ensign Howard: The 2nd parameter is the Senders e-mail address, and in the example I show my e-mail address.

17:09 Ensign Howard: the 3rd parameter is the path to a file or image to be attached, which could be a chart image file like those you create by pressing CTRL+J keys to upload to the Internet or save to the hard disk.

17:09 Ensign Howard: In the example I am not attaching any chart image. So the 3rd parameter is blank.

17:10 Ensign Howard: the 4th parameter is the e-mail address of the recipient, and since I am sending an e-mail to myself, I have my e-mail address in this position as well.

17:11 Ensign Howard: If there are more than 1 recipient, then simply continue to add parameters with the recipient's e-mail address in quotes, separated by commas.

17:11 Ensign Howard: When the ESPL executes the E-mail statement, the e-mail is immediately sent and does not queue in your Outbound folder.

17:12 Ensign Howard: The message for the body of the e-mail is going to be the content of the sList stringlist.

17:12 Ensign Howard: The first statement in the example was to clear this list, since it might have been used before. Statement is sList.Clear.

17:13 Ensign Howard: Then lines of message text can be added to the string list using the sList.Add('....'); type of statement(s).

17:13 Ensign Howard: This example shows one line of message text.

17:13 Ensign Howard: A 2nd line could be added like this: sList.Add('ES #F study alert triggered a Buy'); Have as many sList.Add statements as wanted to write yourself your message

17:15 Ensign Howard: Now you could surround this little example with statements like IF ESPL=51 then Begin..... End;

17:15 Ensign Howard: and put it on the chart as a study that is watching other studies, or some bar conditions, some price levels, or some Alert GV flags.

17:15 Ensign Howard: the example could become like this:

begin

If ESPL = 51 then begin

If GV(1) = 1 then begin

sList.clear;

slist.Add('Study alert on ES #F');17:18 Ensign Howard: email('Alert','ensign2@ensignsoftware.com','','ensign2@ensignsoftware.com');

end;

17:19 Ensign Howard: In this example, the ESPL=51 permits execution for this being a study added to the chart.

17:19 Ensign Howard: The test of GV(1) = 1 would watch for a True flag in the GV[1] global variable being true.

17:20 Ensign Howard: Now you need to be careful that you get one signal only so you are not e-mailing for every tick received.

17:21 Ensign Howard: You might reset the GV[1] flag using ESPL with something like SetGV(1, 0); where 1st parameter is the GV index and 2nd parameter is the value to assign or set.

17:21 Ensign Howard: The e-mail you send to yourself or others will show up in the InBox like this.

17:23 Ensign Howard: Any questions about the ESPL e-mail example? See the ESPL documentation for the topic Email.