Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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

    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

        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.
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by DanielSanMartin, Yesterday, 02:37 PM
            2 responses
            12 views
            0 likes
            Last Post DanielSanMartin  
            Started by DJ888, 04-16-2024, 06:09 PM
            4 responses
            12 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by terofs, Today, 04:18 PM
            0 responses
            11 views
            0 likes
            Last Post terofs
            by terofs
             
            Started by nandhumca, Today, 03:41 PM
            0 responses
            7 views
            0 likes
            Last Post nandhumca  
            Started by The_Sec, Today, 03:37 PM
            0 responses
            3 views
            0 likes
            Last Post The_Sec
            by The_Sec
             
            Working...
            X