Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

single sendmail event sends 50 emails

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

    single sendmail event sends 50 emails

    i have been using sendmail to receive trade and pnl updates for months now with perfect results. after the most recent NT update i now receive 25-50 emails on the first sendmail event of the day, then every sendmail event after just one is sent.

    i have a binary bool that prevents the code from being executed a second time:

    Code:
    if (longoda == 0)
    {
                        if (Close[0] > Close[1])
                        {
                            longoda = 1;
                            EnterLong(1, "LE");
                            SendMail("[email protected]", "Trade Alert - LE", "  LE:  "+Instrument.FullName+"   "+GetCurrentAsk()+
                            "\r\n  RPNL:  "+Math.Round(daypnl, 2)+"  UPNL:  "+Math.Round(openpnl, 2)+"\r\n  Date/Time:  "+ToDay(Time[0])+"    "+ToTime(Time[0]));
                        }
    }
    it's annoying erasing all the emails. again this code has served me well for months. it just started happening with the recent update.

    did the last NT update have a sendmail change?

    #2
    Hello jcash,

    The only noted change I see in the Release Notes page that is relevant to SendMail() has to do with fixing an error when creating a strategy with this method through the Strategy Builder.

    I have tested this in an indicator under a doOnce condition, and I only received one email.

    I would suggest to add prints where you are placing the SendMail() call so you can determine if the strategy is calling SendMail() multiple times.

    Here is the code I have tested with:

    Code:
    private bool doOnce = true;
    protected override void OnBarUpdate()
    {
    	if(State == State.Historical)
    		return;
    	if(doOnce)
    	{
    		SendMail("[email protected]", "Hello", "Test");
    		doOnce = false;
    	}
    }
    I’ve provided a link covering debugging which you may find helpful.

    Debugging: http://ninjatrader.com/support/forum...ead.php?t=3418

    Please let me know if I may be of further assistance.
    JimNinjaTrader Customer Service

    Comment


      #3
      thanks Jim.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by ghoul, Today, 06:02 PM
      3 responses
      14 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by jeronymite, 04-12-2024, 04:26 PM
      3 responses
      44 views
      0 likes
      Last Post jeronymite  
      Started by Barry Milan, Yesterday, 10:35 PM
      7 responses
      20 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by AttiM, 02-14-2024, 05:20 PM
      10 responses
      180 views
      0 likes
      Last Post jeronymite  
      Started by DanielSanMartin, Yesterday, 02:37 PM
      2 responses
      13 views
      0 likes
      Last Post DanielSanMartin  
      Working...
      X