Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time of position update

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

    Time of position update

    Hi:
    I need to know what time an order was executed (or what time the position was updated) in a strategy, I intend to send this info to output, kind of:

    HH.mm:ss Entry order art price X
    HH.mm:ss Target filled at price Y
    HH.mm:ss Entry order art price W
    HH.mm:ss StopLoss filled at price Z

    etc etc
    Is there a way to get the time of the execution?

    Many thanks!

    #2
    You can try using DateTime.Now.
    Should work.

    Comment


      #3
      Hi Packricard,

      Thank you for posting.

      StockFundoo, is correct here. You would want to use DateTime.Now to get the exact time of the execution.

      http://www.ninjatrader.com/support/h...ries_class.htm
      Cal H.NinjaTrader Customer Service

      Comment


        #4
        Thanks, but will it work on backtesting? I guess it will return time NOW, not time when the order was executed (even by the simulator).

        NT strategy performance results shows average time in Market, I need to know (even in backtesting) if the order has been alive in the market for more than X minutes, then close it.
        How can I get this information, then?

        Many thanks!

        Comment


          #5
          Pakricard,

          You can use Time[0] to get the time of the execution from the backtest for the bar, however, this returns the bars' time stamp. which if you are using a time based chart could be different then what the Executions tab will say the execution time.

          Say I had an execution at 12:16 PM but I'm running on a ten minute chart. DateTime.Now will return the current time of the PC when the execution occurred. Time[0] will return the bar timestamp 12:20 PM as this will be the time when the bar closes.

          http://www.ninjatrader.com/support/h....html?time.htm
          Cal H.NinjaTrader Customer Service

          Comment


            #6
            Will do. It's close enough if I use a small timeframe.
            Thanks!

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by MSerag, Yesterday, 11:52 PM
            3 responses
            23 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by dcriador, Yesterday, 01:43 AM
            6 responses
            27 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by James650, Today, 08:25 AM
            1 response
            2 views
            0 likes
            Last Post NinjaTrader_ChristopherJ  
            Started by Rogers101, 05-05-2024, 11:30 AM
            14 responses
            40 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by ETFVoyageur, 04-30-2024, 06:05 PM
            11 responses
            80 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X