Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NinjaTrader.Cbi.Order vs. NinjaTrader.Cbi.IOrder

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

    NinjaTrader.Cbi.Order vs. NinjaTrader.Cbi.IOrder

    I am getting an error "Unable to cast object of type 'NinjaTrader.Cbi.Order' to type 'NinjaTrader.Cbi.IOrder'"

    So, what is the difference between NinjaTrader.Cbi.Order and NinjaTrader.Cbi.IOrder? Is the Order class implementing the interface IOrder?

    #2
    Hello,

    Thanks for the forum post.

    The difference is that iOrder object is supported and is how you get information on the order object and is a read only interface. The order object is one that is undocumented and not supported as to what you would use it for.

    -Brett
    BrettNinjaTrader Product Management

    Comment


      #3
      Can NinjaTrader.Cbi.Order be converted to NinjaTrader.Cbi.IOrder, or vice versa?

      Comment


        #4
        Unfortunately would not expect that to be allowed, however it is possible it could work. Its something you would need to test since your out in unsupported territory.

        -Brett
        BrettNinjaTrader Product Management

        Comment


          #5
          The main issue here is that when a strategy ninjascript is running it create the order in the type of NinjaTrader.Cbi.IOrder, which is fine as long as this order turns into a position. However, if a strategy ninjascript is re-started after it exits or clashes or is down due to whatever reasons, the existing order can be identified in the account order collection, with the type of NinjaTrader.Cbi.Order.

          Why do we have two class types of order if it means the same thing but lives in the different phase of its life cycle?

          Comment


            #6
            trador, as Brett mentioned this is unfortunately unsupported territory here, there's always the concept of strategy positions and orders vs those running on your account hence the different objects used.

            Comment

            Latest Posts

            Collapse

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