NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > Application Technical Support > Miscellaneous Support

Miscellaneous Support Miscellaneous support issues.

Reply
 
Thread Tools Display Modes
Old 06-27-2012, 02:43 PM   #1
tradingGary
Member
 
Join Date: Aug 2009
Location: NYC/Toronto
Posts: 48
Thanks: 4
Thanked 2 times in 2 posts
Default 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("from_email@address.com","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
tradingGary is offline  
Reply With Quote
Old 06-27-2012, 02:48 PM   #2
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

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("from_email@address.com","To_email@addres s.com", "Test Order ", "test");
}
NinjaTrader_RyanM is offline  
Reply With Quote
Old 06-27-2012, 02:57 PM   #3
tradingGary
Member
 
Join Date: Aug 2009
Location: NYC/Toronto
Posts: 48
Thanks: 4
Thanked 2 times in 2 posts
Default

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
tradingGary is offline  
Reply With Quote
Old 06-27-2012, 03:09 PM   #4
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

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.
NinjaTrader_RyanM is offline  
Reply With Quote
Old 07-05-2012, 02:09 PM   #5
tradingGary
Member
 
Join Date: Aug 2009
Location: NYC/Toronto
Posts: 48
Thanks: 4
Thanked 2 times in 2 posts
Default

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
tradingGary is offline  
Reply With Quote
The following user says thank you to tradingGary for this post:
Old 11-12-2012, 12:40 PM   #6
neoikon
Senior Member
 
Join Date: Oct 2008
Location: Austin, TX
Posts: 119
Thanks: 44
Thanked 5 times in 4 posts
Default

Quote:
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
neoikon is offline  
Reply With Quote
Old 01-23-2013, 03:31 AM   #7
zark.be
Senior Member
 
Join Date: Aug 2008
Posts: 102
Thanks: 3
Thanked 2 times in 1 post
Default

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

Strategy Monitoring solution for NinjaTrader.
Don't be slaved to your desk to make sure your automated strategies are running.

zark.be is offline  
Reply With Quote
Old 01-23-2013, 06:29 AM   #8
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,860
Thanks: 163
Thanked 580 times in 571 posts
Default

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?
NinjaTrader_Matthew is offline  
Reply With Quote
Old 01-23-2013, 06:39 AM   #9
zark.be
Senior Member
 
Join Date: Aug 2008
Posts: 102
Thanks: 3
Thanked 2 times in 1 post
Default

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


I've restarted ninja and it started working again.
NinjaMonitor

Strategy Monitoring solution for NinjaTrader.
Don't be slaved to your desk to make sure your automated strategies are running.

zark.be is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending Email from a strategy freewind General Programming 4 06-02-2011 10:25 AM
Sending support email geotabs Miscellaneous Support 1 05-06-2010 08:41 AM
Sending Emails with alerts rfieldjr11 Version 7 Beta General Questions & Bug Reports 1 04-16-2010 07:11 AM
Tradestation email orders-email functionality jsl12 Automated Trading 5 09-13-2008 03:28 PM
Sending executions by email cprins Suggestions And Feedback 1 01-04-2007 01:21 AM


All times are GMT -6. The time now is 03:44 AM.