Topics
10 Jun 2015, 18:18
 4286
 7
Replies

Bl3sS
11 Jun 2015, 21:19

RE:

Spotware said:

Dear Trader,

You can try to use OnBar() method instead of OnTick() method.

Yeah that solved it, i'm too newbie :)


@Bl3sS

Bl3sS
11 Jun 2015, 15:36

Ok I just made It work now the problem is the step 3. I'll figure out step 2

 

What I'm trying to do is to send an email when rsi>70 and when rsi<30 just that simple, this is the code:

 

protected override void OnStart()
        {
            rsi = Indicators.RelativeStrengthIndex(Source, Periods);
        }

        protected override void OnTick()
        {
            if (rsi.Result.LastValue < 30)
            {
                Notifications.SendEmail("xxx@hotmail.com", "xxx@hotmail.com", "buy", "buy");
            }
            else if (rsi.Result.LastValue > 70)
            {
                Notifications.SendEmail("xxxx@hotmail.com", "xxxx@hotmail.com", "sell", "sell");
            }
        }

As I said before I'm a complete beginner, so this just keeps sending emails when trigger happens, like 10emails/sec I just want to get 1 email for each trigger action.

 

Thank you so much.

Btw I'd be nice to have an edit button for the forum :)


@Bl3sS

Bl3sS
11 Jun 2015, 15:15

I finally made It work with hotmail after a few tries, I don't know yet why It wasn't working before...Thank you :)


@Bl3sS

Bl3sS
11 Jun 2015, 14:45 ( Updated at: 21 Dec 2023, 09:20 )

RE:

Spotware said:

Dear Trader,

In order to configure your E-mail settings please perform the following steps:

  1. Go to Preferences and click the field Email Settings

  1. Tick the Enable Email, Use authentication fields.

  2. For gmail tick SSL.

  3. Insert the Sercer (SMTP) and the Port of your Email provider (ex. for gmail Server (SMTP) = smtp.gmail.com , Port = 25).

  4. Then insert the email username and password.

For gmail users only: if you use a two steps authentication, you will need to insert an application password.

WARNING: Email providers do have high level securities that may block users from accessing their accounts using third party applications. In that case users have to go through their Email settings and modify their security settings.

After configuring your E-mail settings you can send Email by triggering the Notifications using the following line:  

Notifications.SendEmail("sender@email","recipient@email","email subject","text");

 

Thank you so much, I've done that quite a few times with different email providers, yet getting the same error. The thing is I want to know where does this timeout error come from, from the email settings? the ctrader configuration?

Thank you for your answer!


@Bl3sS