Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time in position

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

    Time in position

    Hi,

    Is there an easy way to retrieve the time that a position has been open? Example: trade opened at 08:00, currently 11:15 .. Return 195 minutes.

    I know I could create variables and store but maybe NT has native support for this?

    Thanks

    #2
    Hello siroki,

    Thank you for your post.

    There is an average trade duration (http://www.ninjatrader.com/support/h...deduration.htm) but tracking the duration of an open position would need to be done manually.

    You can track the order filled via OnExecution() and then track the time using a variable and storing Time[0] at the time of fill. Then compare the variable for the time of fill against Time[0] to know the value of the duration of the position.

    For information on OnExecution() please visit the following link: http://www.ninjatrader.com/support/h...nexecution.htm
    For information on Time please visit the following link: http://www.ninjatrader.com/support/h...s/nt7/time.htm

    Please let me know if you have any questions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    43 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    25 views
    0 likes
    Last Post PaulMohn  
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    162 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    98 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    158 views
    2 likes
    Last Post CaptainJack  
    Working...
    X