Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Email on Strategy disable ?

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

    Email on Strategy disable ?

    Hi all,
    I understood how to send emails inside a strategy but is it possible to send an email when a strategy is disabled (on error for example) ?
    Same question on a log event ?
    Thanks for your help,
    Nextjob

    #2
    nextjob, you could work with RealtimeErrorHandling set to TakeNoAction and then send yourself an email should run for example into rejected orders which would cause normally a strategy termination. Of course you need to manage the running strategy then still (either reissue rejected orders, or return getting flat and returning out of new ones as an example) -

    Comment


      #3
      Hi Bertrand,
      This is a solution for OrderState.Rejected, but when the strategy stops with OnBarUpdate issue (because I made a mistake in the code for example), the RealtimeErrorHandling set to TakeNoAction will not be efficient and I will not be aware quickly of this...
      Do you have another idea ?

      Comment


        #4
        Correct, this would address rejected orders where the default handling would normally take over to ensure issues are not getting worse - for your case I think you can 'try catch' the code issue and SendMail then on such a condition triggered - http://www.ninjatrader.com/support/f...ead.php?t=9825

        Comment


          #5
          Great ! I will test this.
          Many thanks...

          Comment


            #6
            Bertrand,
            This code is very interesting but unfortunately, it does not allow a global monitoring of the strategies but of piece of code.

            It is possible to build a strategy independent routine which globally reads logs and detects a string like "Disabled strategy= *" and then send a warning mail ?

            Comment


              #7
              nextjob, strategies would unfortunately not cross communciate - you could try logging the info of the individual strategies to text files and then reading this textfile for raising email alerts from an indicator / strategy.

              Comment


                #8
                yes I did this with "File.AppendAllText" command but it is always the same problem, when the strategy exits, the information is in the general logs...

                Comment


                  #9
                  Unfortunately you can't access the log directly - however one might work out to read the log txt file generated by NT with StreamReader -

                  Comment


                    #10
                    Thanks for this idea but is it possible to export logs in a file automatic from a NinjaScript ?

                    Comment


                      #11
                      Unfortunately not, as you can't access the log info programmatically.

                      Comment


                        #12
                        Ok.
                        Is it something planned in version 7 to enable email notification from logs ?

                        Comment


                          #13
                          Yes, you could setup to get email alert type entries (default green ones) - but unfortunately not every log event generated.

                          Comment


                            #14
                            Is it currently available ?

                            Comment


                              #15
                              nextjob,

                              If you want an email to be sent, in your code just add SendMail().
                              Josh P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              583 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              339 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              103 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              554 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              552 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X