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 burtoninlondon, Today, 12:38 AM
        0 responses
        5 views
        0 likes
        Last Post burtoninlondon  
        Started by AaronKoRn, Yesterday, 09:49 PM
        0 responses
        12 views
        0 likes
        Last Post AaronKoRn  
        Started by carnitron, Yesterday, 08:42 PM
        0 responses
        11 views
        0 likes
        Last Post carnitron  
        Started by strategist007, Yesterday, 07:51 PM
        0 responses
        13 views
        0 likes
        Last Post strategist007  
        Started by StockTrader88, 03-06-2021, 08:58 AM
        44 responses
        3,982 views
        3 likes
        Last Post jhudas88  
        Working...
        X