![]() |
|
|||||||
| Miscellaneous Support Miscellaneous support issues. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Aug 2009
Location: NYC/Toronto
Posts: 48
Thanks: 4
Thanked 2 times in 2 posts
|
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 |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
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");
}
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Aug 2009
Location: NYC/Toronto
Posts: 48
Thanks: 4
Thanked 2 times in 2 posts
|
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 |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
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 |
|
|
|
|
|
#5 |
|
Member
Join Date: Aug 2009
Location: NYC/Toronto
Posts: 48
Thanks: 4
Thanked 2 times in 2 posts
|
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 |
|
|
|
|
The following user says thank you to tradingGary for this post: |
|
|
|
#6 | |
|
Senior Member
Join Date: Oct 2008
Location: Austin, TX
Posts: 119
Thanks: 44
Thanked 5 times in 4 posts
|
Quote:
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 |
|
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Aug 2008
Posts: 102
Thanks: 3
Thanked 2 times in 1 post
|
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. |
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,860
Thanks: 163
Thanked 580 times in 571 posts
|
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?
Matthew
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Senior Member
Join Date: Aug 2008
Posts: 102
Thanks: 3
Thanked 2 times in 1 post
|
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. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |