Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Realtime Error Handling

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

    Realtime Error Handling

    Hi-

    I keep getting errors from the following code:

    Code:
                    // Error handling:
                    if (handleErrors == true)
                        RealtimeErrorHandling = RealtimeErrorHandling.StopStrategyCancelOrdersClosePosition;
                    else
                        RealtimeErrorHandling = RealtimeErrorHandling.TakeNoAction;
    The error here being:

    Code:
    Strategy\CRG_Momentum_MultiTimeFrame3.cs    'NinjaTrader.Strategy.RealtimeErrorHandling' does not contain a definition for 'StopStrategyCancelOrdersClosePosition' and no extension method 'StopStrategyCancelOrdersClosePosition' accepting a first argument of type 'NinjaTrader.Strategy.RealtimeErrorHandling' could be found (are you missing a using directive or an assembly reference?)    CS1061 - click for info    123    52
    "handleErrors" is a private bool, set by a public HandleErrors which is part of the strategy parameters:

    Code:
            [Description("Error Handling")]
            [Category("Parameters")]
            public bool HandleErrors
            {
                get { return handleErrors; }
                set { handleErrors = value; }
            }
    Ideas?

    #2
    Hello Cgeorgan,

    You identified a typo in the documentation here. A valid value for this property is:

    StopStrategyCancelOrdersClosePositions

    Thanks for this report. We will correct the documentation.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      No problem - works for me now.

      Comment


        #4
        Interesting. Is there a way to call that as a Method? For example:

        if (MyError)
        {
        StopStrategyCancelOrdersClosePositions();
        }

        I know the above doesn't work, but I'm looking for a single-Strategy alternative to the (unsupported) FlattenEverything() method.

        Thanks.

        Comment


          #5
          MXASJ, unfortunately not, as this a property and not a method.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          599 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          344 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
          558 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          557 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X