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

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 burtoninlondon, Today, 12:38 AM
    0 responses
    9 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    14 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Yesterday, 08:42 PM
    0 responses
    11 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Yesterday, 07:51 PM
    0 responses
    13 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,983 views
    3 likes
    Last Post jhudas88  
    Working...
    X