Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Last TimeStamp Of Session?

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

    Last TimeStamp Of Session?

    I'm interested in code that will figure out the last timestamp of the session. At the absolute last second of the session it will look for the last timestamp using the OnMarketData method.
    Let's say the session ends at 14:00. Then at 13:59:59 it executes. I will be a simple loop that checks if there's a timestamp at a particular time value, if there is, the variable lasttimestamp is assigned that value, otherwise it checks for the next last second, on, and on, until it finds one. I understand the logic, but I'm not sure about the syntax.
    Last edited by Srgtroy; 08-09-2012, 08:06 AM.

    #2
    Hello Srgtroy,
    You can use the GetNextbeginEnd method to get the session start and end time. Please refer to our help guide to know more about it


    You can further custom code it to suit your need.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      This give me the "official" beginning and end times of a session, no? Not when the last trade actually executed.

      Comment


        #4
        Hello Srgtroy,
        Thanks for the clarification.

        You can simply get/store the value from the OnExecution event. A sample code will be like:

        in variable
        Code:
        DateTime lastTrade;
        in OnExecution event
        Code:
        protected override void OnExecution(IExecution execution)
        {
        	lastTrade = execution.Time;
        }

        JoydeepNinjaTrader Customer Service

        Comment


          #5
          I think you misunderstand me. I'm not executing anything. I want the timestamp of the absolute last trade in a bar. Not my trade. Anyone's trade. The absolute last trade. The way ninja works, minute bars always end at 00. But this is not necessarily when the actual last trade occurred. That is what I am trying to determine and access!

          Comment


            #6
            Hello
            You can then use the OnMarketData event to get the time. A sample code will be
            Code:
            protected override void OnMarketData(MarketDataEventArgs e)
            {
            	if (e.MarketDataType == MarketDataType.Last)
            		lastTrade = e.Time;
            }


            Please let me know if I can assist you any further.
            JoydeepNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            601 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            347 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            103 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            559 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            558 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X