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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      57 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      30 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      41 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      58 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      47 views
      0 likes
      Last Post CarlTrading  
      Working...
      X