Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Common Issues to Help Resolve These Output Window errors for NT Strategies

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

    Common Issues to Help Resolve These Output Window errors for NT Strategies

    Hey folks...

    Can you let me know some things I need to look for or common issues that cause the below errors in the Output Window in Strategy code?

    Same strategy code for both FOREX and FUTURES.

    MBTrading on FOREX and CQG on FUTURES at the time of the below. Both are trading on the CQG server and MBT server NOT simply on the NT Sim 101 account FYI.

    1:

    Happens on FUTURES:

    ZB->System.Collections.Generic.KeyNotFoundException : The given key was not present in the dictionary.
    at System.Collections.Generic.Dictionary`2.get_Item(T Key key)
    at NinjaTrader.Indicator.SessionPivots.CalculateValue Area(Boolean isDeveloping)
    at NinjaTrader.Indicator.SessionPivots.OnBarUpdate()

    2:

    Happens on FUTURES:

    **NT** Strategy 'MyStrategyv10_1dbcus/df4b642ff50142dcb4a74f4eceaf00c9' submitted an order that generated the following error 'UnableToChangeOrder'. Strategy has sent cancel requests, attempted to close the position and terminated itself.
    **NT** Strategy 'MyStrategyv10_1dbcus/df4b642ff50142dcb4a74f4eceaf00c9' submitted a cancellation request for Order ID '354562968' has not been confirmed cancelled. Please check your account orders and positions.
    1/10/2014 10:20:20 AM Cancelled pending exit order, since associated position is closed:
    1/10/2014 10:20:21 AM Disable() called: strategy disabled
    1/10/2014 10:20:21 AM CancelAllOrders: BarsInProgress=0
    **NT** Disabling NinjaScript strategy 'MyStrategyv10_1dbcus/df4b642ff50142dcb4a74f4eceaf00c9'

    3:

    Happens on FOREX:

    An over fill was detected on order...(this happens on the FOREX but not FUTURES)...same exact strategy. What things would I look for to fix in the code to adjust for FOREX to make it stop producing over fills being detected?


    #2
    Hello birdog,

    Thanks for your post.

    1) This message indicates that a particular key was attempted to be accessed in a dictionary or list. Are you using a list or dictionary in your code? Be sure that logically the key would exist in the list or dictionary before trying to call this.

    2) and 3) These messages indicate that you are trying to cancel an order that has already filled.

    I would recommend checking the state of the order before attempting to cancel this.

    private IOrder myOrder = null;
    myOrder = EnterLongLimit(1, Close[0]);
    if (myOrder.OrderState != OrderState.Filled)
    {
    CancelOrder(myOrder);
    }
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      @koganam would you have any thoughts as well here?

      Comment


        #4
        Originally posted by NinjaTrader_ChelseaB View Post
        Hello birdog,

        Thanks for your post.

        1) This message indicates that a particular key was attempted to be accessed in a dictionary or list. Are you using a list or dictionary in your code? Be sure that logically the key would exist in the list or dictionary before trying to call this.

        2) and 3) These messages indicate that you are trying to cancel an order that has already filled.

        I would recommend checking the state of the order before attempting to cancel this.

        private IOrder myOrder = null;
        myOrder = EnterLongLimit(1, Close[0]);
        if (myOrder.OrderState != OrderState.Filled)
        {
        CancelOrder(myOrder);
        }
        Hey there...thanks for the follow up...

        1. Ok on #1. Thanks.

        2. Do you mean to include the above could in the strategy? Can you send me a sample .cs that has it included?

        Comment


          #5
          Originally posted by birdog View Post
          @koganam would you have any thoughts as well here?
          Not really. The questions are too generic. Essentially if you meet an exception, you will have to check for the exception before you act. In this case make sure that the bid or ask, as the case may be, is in correct position relative to your intended order price.

          Comment


            #6
            Hi birdog,

            Thanks for your reply. As kognam was saying there isn't really a fix all for all over fills. If you would like, you can create a simplified "toy" of your strategy that only has the code necessary to reproduce this issue and we can give you tips to try and correct it.
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            648 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            369 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            108 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            572 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            574 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X