Configuring Email Notifications
Email Notifications Functionality¶
You can set your cBots/indicators to send you email notifications based on the actions they take.
For example, a robot trader may send you emails every time a position is opened or a take profit/stop loss is hit. For indicators, you may wish to receive a notification when an indicator value reaches a certain threshold.
Email Notifications Settings¶
For cTrader extensions to send emails to your email address, you first have to configure several settings. To do so, perform the below actions.
- Open the 'Email' tab located in the 'Advanced' section in the cTrader settings window.
Activate the 'Enable Email' flag.
If your email provider requiresn an encrypted connection (most do), enable the 'Use SSL' flag. Specify the SMPT server and port values. They can be attained as follows.
|Gmail||Select 'I want to enable IMAP', then choose 'Other' and use the 'Outgoing Mail' settings.|
|Hotmail/MSN/Live||Find the SMPT server in the settings.|
|Yahoo||Use the 'Outgoing Mail' settings.|
|AOL||Use the 'Outgoing Mail' settings.|
|Other providers||Please, consult your providers' help page.|
Enter your username and password. In most cases, your username is also your full email address.
Click on 'Apply'.
cBot/Indicator Code for Email Notifications¶
To enable email notifications based on any event, do the following.
Select a cBot or an indicator from the main list.
In the code editor, find the action you want to receive emails for. For example, find the
OnPositionOpened()method if you would like to receive notifications for every position opened by your cBot.
In the method body, type
Notifications.SendEmail("email@example.com", "firstname.lastname@example.org", "Email Subject", "Email body");. Your code should look like this.
1 2 3 4 5 6
- Click the 'Build' button to apply the changes. Ensure that the build is successful.