Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

"Flatten everything"

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

    "Flatten everything"

    I've always had with this curiosity to know which programmatic solution best approximates best the right click on the position tab "Flatten everything" which appears to be the most reliable method.
    I am interested in a solution that could stop the strategies and one that would not.

    I tried

    1) submissionAccount.Flatten(new[] { Instrument.GetInstrument(Instrument.ToString()) })

    2) A file OIF ---- "FLATTENEVERYTHING;;;;;;;;;;;;";

    3) [DllImport("NTDirect.dll", EntryPoint = "FlattenEverything")]
    public static extern void FlattenEverything();


    4) CancelAllOrders(Instrument instrument)

    5) Account.Flatten(new [] { Instrument.GetInstrument("ES 12-15") });

    6) Getting positions and submit the closing order with CreateOrder

    Any suggestion or comment?
    Best
    Gio

    #2
    My question is, which one of these methods matches the flattening everything of the position tab/chart-trader chart?

    Comment


      #3
      Hello,

      For NinjaScript strategies there is no Flatten everything for all instruments on an account. The closest thing is .Flatten() but you need to pass in a specific instrument is used on an Account basis, which would be using the AddOn approach. So you would need to get all positions on the account and call flatten on each instrument.

      Comment


        #4
        Thank you Gaby

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        53 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        130 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        70 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        44 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        49 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X