Skip to content

Configuring Email Notifications

General Information

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.

Image title

  • 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.

Email Provider Actions
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'.

Sending Notifications Programmatically

To enable email notifications based on any event, do the following.

  • Select a cBot or an indicator from the main list. Make sure that you have access to its source code.

  • 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("sendersaddress@email.com", "recipientaddress@email.com", "Email Subject", "Email body");. Your code should look like this.

1
2
3
4
5
6
  protected override void OnPositionsOpened()
  {
      SignalLineRepository.Dispose();
      DrawManager.Dispose();
      Notifications.SendEmail("sendersaddress@email.com", "recipientaddress@email.com", "Email Subject", "Email body");
  }
  • Click the 'Build' button to apply the changes. Ensure that the build is successful.

  • Add a new instance of your chosen algo (cBots and indicators only).