Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Email Service

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

    Email Service

    I have a strategy that doesn't buy/sell anything but instead sends periodic emails to update me throughout the day as to general status. At 9:30am, 10, 11, 12pm, 1pm, 2pm, 3pm, & 4pm it sends an email to a vtext address.

    What is happening is that commonly I will receive duplicate messages and sometimes miss others. For example: 9:30am, 10am, 11am, & 12pm I get a proper message but then 1pm I get two messages exactly the same then 2pm & 3pm are fine but then it skips 4pm. Then the next day a similar issue will happen but I may get two messages at the 2pm and 3pm times and then miss 4pm. It seems to not be very consistent as well.

    So I added a print function to the strategy so it records each time OnBarUpdate occurs. This log file shows a proper entry for each minute of the ETH day so the strategy is not running multiple times on a single bar. I then am able to view the gmail sent mail folder and there I can see that NT is sending some messages twice or just not sending them at all. Some days everything works just fine with a single message at each interval time.

    Has anyone seen this before or might you have any additional points that I should try to look at? Attached is the strategy for reference and the print output from each OnBarUpdate showing proper operation.

    Thanks,
    Joe
    Last edited by antrux; 06-25-2017, 06:20 PM.

    #2
    Hello antrux,

    Thanks for opening the thread.

    It would make sense that you would not receive an email if for example the OnBarUpdate() iteration is not exactly on the hour.

    I would advise to modify the code to troubleshoot further. I'd suggest to place a unique Print() for when each email that gets fired so you can tell if those SendMail() calls get reached if you are missing a message in your inbox. You will also be able to tell if multiple SendMail() calls are being sent from your logic if you are receiving multiple emails.

    If you then realize your logic is allowing multiple fires or missing others, you would be able to adjust the strategy so:

    1) Each SendMail() is only called once
    2) Each SendMail() is only called between an interval where a bar should close

    Here is an example that demonstrates how you can ensure an action will occur once bar forms and OnBarUpdate() is iterated within its range.

    Code:
    int timePlus = 0;
    if(BarsPeriod.BarsPeriodType == BarsPeriodType.Minute)
    	timePlus = BarsPeriod.BaseBarsPeriodValue * 100;
    if ((ToTime(Time[0]) >= ToTime(10,00,00))
    	&& (ToTime(Time[0]) < (ToTime(10,00,00) + timePlus)))
    If you are still able to receive duplicate emails, and you are noticing that you only have one print associated with each SendMail(), please let me know so we can investigate further.
    JimNinjaTrader Customer Service

    Comment


      #3
      It was a timing issue. I ran a bandwidth and connection monitor and it shows consistent numbers all day on my end so it must be something else slowing the processing of each strategy instance from time to time. As it appears Kinetick data may be going slower at various times throughout the day if the market is extra busy OR NT is going slower due to more tick data per each minute bar during busy times of the day. NT is running 450+ strategy instances each on minute bars.

      I changed to process on bar count instead of time. Ex, FirstBarOfSession is 9:30am for RTH and bar 30 is 10am and etc. This should catch them all.

      Unfortunately I wasn't able to catch a double message send using the added Print statements so I'll leave those in and see if it continues. I guess it is possible for say the 9:59am bar to process late at say 10:00:05 then within a minute the real 10:00am bar is then downloaded and processed in the same minute. That could give two sent messages almost at the same time but I'll keep watching for it.

      Thank you,

      Comment


        #4
        Is that 450 different symbols?

        There are slow periods in the market where nothing happens - and you don't get that minute bar in NT until something happens a few minutes later.

        Comment


          #5
          Yes there are a lot of symbols that I've filtered to run on. It's my method of diversification when purely doing technical/trend trading. Can't catch those nice new trends early unless it's being monitored.

          I run the alert strategy on AAPL since I've yet to see it miss a minute bar and since it's not used on the list for actual trading. Other more randomly chosen symbols could easily not process because there wasn't any data to compute a bar with during that minute. Now, counting bars should be a more reliable method.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by bortz, 11-06-2023, 08:04 AM
          47 responses
          1,603 views
          0 likes
          Last Post aligator  
          Started by jaybedreamin, Today, 05:56 PM
          0 responses
          8 views
          0 likes
          Last Post jaybedreamin  
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          18 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Jon17, Today, 04:33 PM
          0 responses
          4 views
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          12 views
          0 likes
          Last Post Javierw.ok  
          Working...
          X