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 charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      55 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      142 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      160 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      96 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      276 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X