Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Issue with Account.Flatten

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

    Issue with Account.Flatten

    I;ve emulated code from the NT 8 manual to flatten my positions but it is throwing an error:

    Code:

    Instrument myInstrument = Cbi.Instrument.GetInstrument("ES 12-15");
    myAccount.Flatten(myInstrument);

    Generates error CS1503 - Argument 1: cannot convert from 'NinjaTrader.Cbi.Instrument' to 'System.Collections.Generic.ICollection<NinjaTrade r.Cbi.Instrument>'

    Not sure if this is a bug or I've done something wrong.

    I've tried using just myAccount.Flatten(Instrument); and this doesn't work, however using myAccount.CancelAllOrders(Instrument); does work (compiles and closes orders as intended).

    Thanks
    daqu40
    NinjaTrader Ecosystem Vendor - QTradez

    #2
    I see our documentation is wrong here, I'll have that fixed up. Thanks.

    It's looking for a collection of instruments, even if that is just one:

    Code:
    Account.Flatten(new [] { Instrument.GetInstrument("ES 12-15") });
    MatthewNinjaTrader Product Management

    Comment


      #3
      Thanks Matthew,

      Dissecting the error I figure this out. It would be helpful to others if the manual gets update to make this clear.
      daqu40
      NinjaTrader Ecosystem Vendor - QTradez

      Comment


        #4
        I've updated it now, please let me know if I can clarify anything else with this (or any other account) methods:

        MatthewNinjaTrader Product Management

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by lightsun47, Today, 03:51 PM
        0 responses
        4 views
        0 likes
        Last Post lightsun47  
        Started by 00nevest, Today, 02:27 PM
        1 response
        8 views
        0 likes
        Last Post 00nevest  
        Started by futtrader, 04-21-2024, 01:50 AM
        4 responses
        44 views
        0 likes
        Last Post futtrader  
        Started by Option Whisperer, Today, 09:55 AM
        1 response
        13 views
        0 likes
        Last Post bltdavid  
        Started by port119, Today, 02:43 PM
        0 responses
        8 views
        0 likes
        Last Post port119
        by port119
         
        Working...
        X