Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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) -

    BertrandNinjaTrader Customer Service

    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
        BertrandNinjaTrader Customer Service

        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.
              BertrandNinjaTrader Customer Service

              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 -

                  BertrandNinjaTrader Customer Service

                  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.
                      BertrandNinjaTrader Customer Service

                      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.
                          BertrandNinjaTrader Customer Service

                          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 algospoke, 04-17-2024, 06:40 PM
                              6 responses
                              49 views
                              0 likes
                              Last Post algospoke  
                              Started by arvidvanstaey, Today, 02:19 PM
                              4 responses
                              11 views
                              0 likes
                              Last Post arvidvanstaey  
                              Started by samish18, 04-17-2024, 08:57 AM
                              16 responses
                              61 views
                              0 likes
                              Last Post samish18  
                              Started by jordanq2, Today, 03:10 PM
                              2 responses
                              11 views
                              0 likes
                              Last Post jordanq2  
                              Started by traderqz, Today, 12:06 AM
                              10 responses
                              21 views
                              0 likes
                              Last Post traderqz  
                              Working...
                              X