Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Email functionality stopped sending out emails

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

    Email functionality stopped sending out emails

    Hello NT,

    My email statement stopped working for no apparent reason, this has been working for over 5 months with no issues.

    protected override void Initialize()
    {
    CalculateOnBarClose = true;
    }
    protected override void OnBarUpdate()
    {
    SendMail("[email protected]","To_email@addres s.com", "Test Order ", "test");
    }

    When I go Options>Misc Tab and I do a test email, it does send out an email correctly.

    Can you help troubleshooting this. I see no issues in the log.

    The only thing that changed on this machine is the java, windows updates.


    Thank you,
    Gary

    #2
    Hi Gary,

    If test email works then the programatic one should as well. The main thing to check is that this is executed on a real time update, as it's not sent on historical bars. If it's ran on real time bars and the email is not sent, there should be a failure message in log tab indicating why.

    Code:
    protected override void OnBarUpdate()
    {
    Print("Historical is: " + Historical); //check in output window that this is executed and Historical = false. 
    SendMail("[email protected]","To_email@addres s.com", "Test Order ", "test");
    }
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hi, thanks for the quick reply.

      The test strategy I created does run on bar update method of 1 minute bars and the print statement
      Print("Test Email" + Input[0].ToString("0.0000") + " P&L: " + Performance.AllTrades.TradesPerformance.Currency.C umProfit.ToString("C") + " AccountValue: " + GetAccountValue(AccountItem.CashValue).ToString("C "));
      does print out the correct output, but there is nothing in the log and no emails... Hence, the reason for my post.

      Thanks,
      Gary

      Comment


        #4
        The critical part here is value of Historical property. What is the output if you use the snippet I posted in my first reply?

        Historical can be true when you might not expect it -- if the strategy is in a historical position upon startup and you have set to "wait until flat" before entering.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Ryan,

          Thanks for the reply, wanted to give an update to everyone before I forget -- When I tried to print the Historical value using the print statement (I couldn't see it because The output window would not open up. I am not sure how this is possible or why, but after restarting NT with no solution I reinstalled NT and it started working fine....

          Thanks,
          Gary

          Comment


            #6
            Originally posted by NinjaTrader_RyanM View Post
            Hi Gary,

            If test email works then the programatic one should as well. The main thing to check is that this is executed on a real time update, as it's not sent on historical bars. If it's ran on real time bars and the email is not sent, there should be a failure message in log tab indicating why.
            Hello, I WAS running into a similar problem, but after a lot of playing around, I believe I fixed it and wanted to share my results for others.

            My original situation:

            - I can send a test email from settings, but not from code.

            - I've verified that CalculateOnBarClose and Historical are both false (from looking at the code and from doing a Print() ).

            - When I save my email settings, then exit NT, then re-open NT, my email settings are blanked out in the settings. When I exit NT, I do click "Yes to all" when asked to save (but that's more Workspace related anyway, so shouldn't matter).

            - When I initially fill out my email setting and click "test", I get this error, "Failed to Send Mail: The remote certificate is invalid according to the validation procedure." If I hit OK and close the settings, then go back into the settings, then click "test" again, it succeeds and I actually get an email (but calling from code still fails). And again, if I restart NT, it clears out these email settings.

            - Nothing odd in the Log (except noting that "remote certificate is invalid" error mentioned above).


            In the end, it turned out that AVG had something to do with it (my anti-virus). When I temporarily disabled it, then saved the email settings, it allowed it to actually save the settings to disk properly and all started working properly (including sending from code, which makes sense).

            Perhaps there is a way that NT can know if settings are not being saved to the disk properly and can output something in the LOG file?

            Thanks!
            Daniel
            neoHarmonics.com

            Comment


              #7
              I'm experiencing a very similar issue


              All of a sudden, mails from strategy aren't being sent !
              the last mail i received was yesterday, and since then, nothing. Nothing was changed since then, no restart, reboot, update, nothing.

              The test email functionnality DOES work.

              I tryed with the Print(Historical) and it does return false as it should. But mails from the strategy aren't being sent, nothing in the log or trace or console.
              Furthermore, i have access to the email server logs, and there isn't even a connection attempt !


              I have AVG, i tryed disabling it, but no change.

              Comment


                #8
                Is this the same after restarting NinjaTrader?

                Is it only your one strategy that is not firing?

                As a test, can you create a very simple strategy to test the SendMail() function?
                MatthewNinjaTrader Product Management

                Comment


                  #9
                  I've updated my strategy to send a mail at every bar, but nothing.


                  I've restarted ninja and it started working again.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by zstheorist, Today, 07:52 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post zstheorist  
                  Started by pmachiraju, 11-01-2023, 04:46 AM
                  8 responses
                  150 views
                  0 likes
                  Last Post rehmans
                  by rehmans
                   
                  Started by mattbsea, Today, 05:44 PM
                  0 responses
                  6 views
                  0 likes
                  Last Post mattbsea  
                  Started by RideMe, 04-07-2024, 04:54 PM
                  6 responses
                  33 views
                  0 likes
                  Last Post RideMe
                  by RideMe
                   
                  Started by tkaboris, Today, 05:13 PM
                  0 responses
                  6 views
                  0 likes
                  Last Post tkaboris  
                  Working...
                  X