Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to determine how many bars an order has been open?

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

    How to determine how many bars an order has been open?

    How to determine how many bars an order has been open?

    #2
    Hello boreland,

    Thanks for your post.

    You can use the method BarsSinceEntryExecution(). Please see the help guide for key details and example: https://ninjatrader.com/support/help...yexecution.htm

    Alternatively, if you are placing market orders which usually fill immediately, you can create an integer counter that is set to zero when you place the order and then you increment it on each new bar. Otherwise if using limit orders that may not fill right away you can check to see if the order is filled in OnOrderUpdate(), OnExecutionUpdate(), or OnPositionUpdate() and reset the class level variable integer counter there.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    62 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    134 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    75 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X