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 kinfxhk, 07-13-2026, 10:18 AM
          0 responses
          33 views
          0 likes
          Last Post kinfxhk
          by kinfxhk
           
          Started by kinfxhk, 07-13-2026, 09:50 AM
          0 responses
          26 views
          0 likes
          Last Post kinfxhk
          by kinfxhk
           
          Started by kinfxhk, 07-13-2026, 07:21 AM
          0 responses
          35 views
          0 likes
          Last Post kinfxhk
          by kinfxhk
           
          Started by kinfxhk, 07-11-2026, 02:11 AM
          0 responses
          31 views
          0 likes
          Last Post kinfxhk
          by kinfxhk
           
          Started by SalmaTrader, 07-07-2026, 10:26 PM
          0 responses
          141 views
          0 likes
          Last Post SalmaTrader  
          Working...
          X