Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 pibrew, Today, 06:37 AM
      0 responses
      0 views
      0 likes
      Last Post pibrew
      by pibrew
       
      Started by rbeckmann05, Yesterday, 06:48 PM
      1 response
      12 views
      0 likes
      Last Post bltdavid  
      Started by llanqui, Today, 03:53 AM
      0 responses
      6 views
      0 likes
      Last Post llanqui
      by llanqui
       
      Started by burtoninlondon, Today, 12:38 AM
      0 responses
      10 views
      0 likes
      Last Post burtoninlondon  
      Started by AaronKoRn, Yesterday, 09:49 PM
      0 responses
      15 views
      0 likes
      Last Post AaronKoRn  
      Working...
      X