Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unsupported Account.Positions

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

    Unsupported Account.Positions

    I know that the Account Class is not supported by NinjaTrader, so maybe other users can share their knowledge...

    As others have posted, there are many of us who want to know if a position is open (by another strategy, or manually)

    I got a teaser from NT support suggesting that I use the following:

    if( Account.Positions[X].Quantity > 0)
    {
    do something
    }

    When I use this (with whatever value of X) I get an error shown in the output window that states:
    Error on calling 'OnBarUpdate' method for strategy 'aHLR/85221e0f1568470fb4c1126f00b100b6': You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.

    I do not have any other code related to this class. Am I missing something?
    Last edited by RodS7; 11-07-2012, 10:38 AM.

    #2
    one other thing...

    I do have

    if(CurrentBar < BarsRequired) return;

    in the code.

    Comment


      #3
      I found the solution

      After applying some diverse search parameters in the forum (for the Nth time), I found something that works!

      If anyone else is interested, check out this:


      Good trading!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      65 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      35 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      59 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      62 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      51 views
      0 likes
      Last Post CarlTrading  
      Working...
      X