Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Checking position status

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

    Checking position status

    truing to debug my script, I need to check at 155900 which direction my position is.
    so I use.
    if(ToTime(Times[0][0])==155500)
    {
    Print("position " + (Position.MarketPosition.ToString()));
    }
    but on outlook window it shows:
    position Short
    position Flat
    I do not know why it shows twice (since I am using times[0][0]) nor why it shows two different position direction. This is happening for all days..
    Any clue? how can I Print my position for any timing?

    #2
    Hello,
    Your code to check the time of the primary series is correct however it may be calling OnBarUpdate multiple times if you have added data series.
    Do you receive the same if you set the code within if(BarsInProgress == 0)?
    Cody B.NinjaTrader Customer Service

    Comment


      #3
      Problem solved

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      631 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      566 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X