Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Prevent strategy from disabling when there is an error?

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

    Prevent strategy from disabling when there is an error?

    Hello,

    I was wondering if there is any way to prevent a strategy from disabling itself when there is an error. I had an overfill error on a strategy last night while I was asleep and so of course it disabled the entire strategy -- I would like to know if there is a workaround or feature I can use to prevent the strategy from disabling when this happens, and to keep running anyway.

    Regards,

    Andrew

    #2
    Hello LightWeight,

    Thank you for your inquiry.

    You would want to have IgnoreOverFill set to true in your intialize method as shown below:

    protected override void Initialize()
    {
    // Allows for custom overfill handling
    IgnoreOverFill = true;
    }
    Please, be advised that doing this can have serious adverse affects on a running strategy unless you have programmed your own overfill handling. Overfill handling should only be addressed by experienced programmers.

    For more information about IgnoreOverFill, please take a look at the NinjaTrader help guide at this link: http://www.ninjatrader.com/support/h...reoverfill.htm

    The help guide also include a very handy alphabetical reference guide for NinjaScript as well: http://www.ninjatrader.com/support/h..._reference.htm

    Please, let us know if we can be of further assistance!
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Strategy Disabled Alert

      following on from this is there a function that detects when a strategy is disabled and sends an email via sendmail() ? Regards and thx

      Comment


        #4
        Hello everington_f,

        Thank you for your inquiry.

        You would be able to use the OnTermination() method to place your SendMail() into to send an email when your strategy is shutting down.

        Example:
        Code:
        protected override void OnTermination() 
        {
             SendMail(....);
        }
        Zachary G.NinjaTrader Customer Service

        Comment


          #5
          Ok that will work... but will upon termination will only one email be sent or will I get multiple copies?
          Regards and thx

          Comment


            #6
            Hello everington_f,

            As long as you have only one SendMail() call in OnTermination(), it will only send one email. OnTermination() is only called once.
            Zachary G.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            83 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            47 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            29 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            32 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            66 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X