Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

sendmail Issues

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    sendmail Issues

    HI, I can't get sendmail() to work, I get this error "Failed to send mail: System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"

    Test email does work.

    Thanks.

    #2
    It is now working, but sending emails non stop.

    Comment


      #3
      Hello bougie,

      Can you confirm that when you did the test email that you received the email that will be tittle "NinjaTrader test mail" in the subject line and inside the body it will state "This is a test mail"?

      Also, do you have any firewalls, antivirus, or other scanning software installed on your computer? If so, could you try disabling it and trying it again.
      JCNinjaTrader Customer Service

      Comment


        #4
        Hello bougie,

        Glad to hear that it is working.

        It may be due to the conditions where you are calling the SendMail() function. Could you post a snippet of code on the conditions you are calling the SendMail() and what you have Calculate on Bar close set to?

        http://www.ninjatrader.com/support/h...onbarclose.htm
        JCNinjaTrader Customer Service

        Comment


          #5
          if(CrossAbove( RSI(14, 3),30,1) || CrossBelow(RSI(14, 3),70,1))
          Alert(
          "myAlert", NinjaTrader.Cbi.Priority.High, "RSI Alert", "Alert3.wav", 10, Color.Black, Color.Yellow);

          SendMail(
          "[email protected]", "[email protected]", "Instrument.FullName", "RSI has crossed limit");


          and just added this below the above code

          {
          // Calculate on the close of each bar
          CalculateOnBarClose = true;
          }
          Last edited by bougie; 10-12-2012, 09:41 AM.

          Comment


            #6
            Hello bougie,

            Code:
            if(CrossAbove( RSI(14, 3),30,1) || CrossBelow(RSI(14, 3),70,1))
            Alert("myAlert", NinjaTrader.Cbi.Priority.High, "RSI Alert", "Alert3.wav", 10, Color.Black, Color.Yellow);
            
            SendMail("[email protected]", "[email protected]", "Instrument.FullName", "RSI has crossed limit");
            It is going to repeatidly call the SendMail() method because there is a ";" at the end of your Alert() marking then end of it so your SendMail() is being called on every OnBarUpdate. You may change it to the following:

            Code:
            if(CrossAbove( RSI(14, 3),30,1) || CrossBelow(RSI(14, 3),70,1))
            {
            Alert("myAlert", NinjaTrader.Cbi.Priority.High, "RSI Alert", "Alert3.wav", 10, Color.Black, Color.Yellow);
            SendMail("[email protected]", "[email protected]", "Instrument.FullName", "RSI has crossed limit");
            }
            Last edited by NinjaTrader_JC; 10-12-2012, 10:34 AM.
            JCNinjaTrader Customer Service

            Comment


              #7
              hi, I copied and pasted the code, now getting errors.

              Click image for larger version

Name:	nt err4.jpg
Views:	1
Size:	98.1 KB
ID:	866201

              Comment


                #8
                Hello bougie,

                I appoligize I put the cureley brace in the wrong posiiton. You may try this revised code:

                Code:
                if(CrossAbove( RSI(14, 3),30,1) || CrossBelow(RSI(14, 3),70,1))
                {
                Alert("myAlert", NinjaTrader.Cbi.Priority.High, "RSI Alert", "Alert3.wav", 10, Color.Black, Color.Yellow);
                SendMail("[email protected]", "[email protected]", "Instrument.FullName", "RSI has crossed limit");
                }
                JCNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by XXtrader, Yesterday, 11:30 PM
                2 responses
                11 views
                0 likes
                Last Post XXtrader  
                Started by Waxavi, Today, 02:10 AM
                0 responses
                6 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Started by TradeForge, Today, 02:09 AM
                0 responses
                11 views
                0 likes
                Last Post TradeForge  
                Started by Waxavi, Today, 02:00 AM
                0 responses
                2 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Started by elirion, Today, 01:36 AM
                0 responses
                7 views
                0 likes
                Last Post elirion
                by elirion
                 
                Working...
                X