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 Shansen, 08-30-2019, 10:18 PM
        25 responses
        949 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by JonesJoker, 04-22-2024, 12:23 PM
        8 responses
        41 views
        0 likes
        Last Post JonesJoker  
        Started by timko, Today, 06:45 AM
        0 responses
        3 views
        0 likes
        Last Post timko
        by timko
         
        Started by Waxavi, 04-19-2024, 02:10 AM
        2 responses
        39 views
        0 likes
        Last Post poeds
        by poeds
         
        Started by chbruno, Yesterday, 04:10 PM
        1 response
        44 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X