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 CarlTrading, 03-31-2026, 09:41 PM
          1 response
          47 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          23 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          33 views
          1 like
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          51 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          42 views
          0 likes
          Last Post CarlTrading  
          Working...
          X