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 geddyisodin, 04-25-2024, 05:20 AM
        8 responses
        60 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by jxs_xrj, 01-12-2020, 09:49 AM
        4 responses
        3,286 views
        1 like
        Last Post jgualdronc  
        Started by Option Whisperer, Today, 09:55 AM
        0 responses
        5 views
        0 likes
        Last Post Option Whisperer  
        Started by halgo_boulder, 04-20-2024, 08:44 AM
        2 responses
        22 views
        0 likes
        Last Post halgo_boulder  
        Started by mishhh, 05-25-2010, 08:54 AM
        19 responses
        6,189 views
        0 likes
        Last Post rene69851  
        Working...
        X