Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Query account position

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

    Query account position

    Hi there,

    1) I want to query my broker account position for a particular instrument (not the strategy position, the broker account position) ... how do I go about that ?

    2) In the same vein, how do I get the list of all open orders in my broker account ? (again, not the strategy-generated orders, all open orders).

    Thanks in advance
    Dominique

    #2
    Hello Dominique,

    We do not currently have a documented/supported method to query the account to retrieve positions and orders. The strategy methods will only be aware of that particular strategy instance. However it is possible. Here's a hint to get you started

    Code:
    foreach (Account acct in Cbi.Globals.Accounts)
    {
    if (acct.Positions != null)
    {
    PositionCollection positions = acct.Positions;
    foreach (Position pos in positions)
    {
    Print(pos.Account.Name + " " + pos.Instrument + " " + pos.MarketPosition + " " + pos.Quantity + " " + pos.AvgPrice);
    }
    }
    MatthewNinjaTrader Product Management

    Comment


      #3
      Getting account position NT7

      Simple situation is that whenever I turn my computer off any restart means that open positions entered by a swing strategy account previously will not be reflected in the strategy on restart. Syncing will simply close positions in the account prematurely.

      I need to be able to read the account.instrument position from within the strategy.
      ideas on this please. It is an important point.Syncing only imposes the strategy position on the Account position... there has to be a way for the strategy position to be determined by the account position.

      I have used the snippet of code below to print to output all posiitons... is it then a case of creating variables based on those outputs? Regards
      Last edited by elliot5; 04-28-2016, 03:21 AM.

      Comment


        #4
        Hello everington_f,

        Thank you for your post.

        Once you have pulled the account positions you can then check them to see what they are and then submit your orders in the strategy to protect or adjust those positions as needed. This would require understanding that the strategy position will likely not match your account position and you would be tracking the account position and adjusting it manually. You would also need to use the Unmanaged Approach in order to achieve this. You can find information on the Unmanaged Approach at the following link: http://ninjatrader.com/support/helpG...d_approach.htm
        Patrick H.NinjaTrader Customer Service

        Comment


          #5
          Account position / Order status

          Thankyou for your feedback Patrick. With NT8 of course this is no longer an issue. I shall play around with it for NT7 and when I get a result will post it for all. Regards

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by ntbone, Today, 10:31 PM
          0 responses
          9 views
          0 likes
          Last Post ntbone
          by ntbone
           
          Started by dpolyakov, Today, 09:58 PM
          0 responses
          4 views
          0 likes
          Last Post dpolyakov  
          Started by Bidder, Today, 09:07 PM
          0 responses
          6 views
          0 likes
          Last Post Bidder
          by Bidder
           
          Started by frslvr, Today, 05:42 PM
          0 responses
          8 views
          0 likes
          Last Post frslvr
          by frslvr
           
          Started by frslvr, Today, 04:29 PM
          0 responses
          14 views
          0 likes
          Last Post frslvr
          by frslvr
           
          Working...
          X