• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Why does time not follow replay?

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

    Why does time not follow replay?

    Hi there, the time printed, is not following the time of the replay. My code is:

    CalculateOnBarClose = false;
    ...
    if (FirstTickOfBar) {
    Print("First tick of bar, at time " + Time[0] + ", at close " + Close[0]);
    } else {
    Print("At time " + Time[0] + ", at close " + Close[0]);
    }

    I'm replaying the day, tick-by-tick, and my output looks like:

    At time 6/27/2017 10:20:00 AM, at close 2428.75
    At time 6/27/2017 10:20:00 AM, at close 2428.75
    At time 6/27/2017 10:16:03 AM, at close 2428.75
    At time 6/27/2017 10:16:03 AM, at close 2428.75
    At time 6/27/2017 10:20:00 AM, at close 2428.75
    At time 6/27/2017 10:20:00 AM, at close 2428.75
    At time 6/27/2017 10:16:04 AM, at close 2428.75
    At time 6/27/2017 10:16:04 AM, at close 2428.75
    At time 6/27/2017 10:20:00 AM, at close 2429
    At time 6/27/2017 10:20:00 AM, at close 2429
    At time 6/27/2017 10:16:04 AM, at close 2429
    At time 6/27/2017 10:16:04 AM, at close 2429
    At time 6/27/2017 10:20:00 AM, at close 2429
    At time 6/27/2017 10:20:00 AM, at close 2429
    At time 6/27/2017 10:16:05 AM, at close 2429
    At time 6/27/2017 10:16:05 AM, at close 2429
    At time 6/27/2017 10:20:00 AM, at close 2428.75
    At time 6/27/2017 10:20:00 AM, at close 2428.75
    At time 6/27/2017 10:16:06 AM, at close 2428.75
    At time 6/27/2017 10:16:06 AM, at close 2428.75

    I'm replaying on the ES, on a 4 minute bar, but I always get this situation. I don't understand why the times are out of sequence? Since I'm replaying by the second, I would think I would see the printed time increase by one second at a time, with the current price. That is, I'd think the output would be like:

    At time 6/27/2017 10:20:01 AM, at close 2428.75
    At time 6/27/2017 10:20:02 AM, at close 2428.75
    At time 6/27/2017 10:20:03 AM, at close 2428.75
    At time 6/27/2017 10:20:04 AM, at close 2429.00

    Your thoughts? Thanks.
    Attached Files

    #2
    Do you have a secondary dataseries?

    Comment


      #3
      Originally posted by sledge View Post
      Do you have a secondary dataseries?
      I'm pretty sure I don't. But, I am able to break it down. For instance, for just one tick of the bar, an example of output:

      At time 6/27/2017 10:36:00 AM, at close 2429.5
      At time 6/27/2017 10:36:00 AM, at close 2429.5
      At time 6/27/2017 10:33:59 AM, at close 2429.5
      At time 6/27/2017 10:33:59 AM, at close 2429.5

      That is, one tick somehow translates into four statements. The first two have a time always divisible by 4 minutes (am using a 4 minute chart). The second two are accurate, of the current time and market value.

      Comment


        #4
        Hello timmbbo,

        I would also be suspicious of a secondary data series added in your code.

        Could you test the code attached and see if you get the same results I am?

        Demo: https://www.screencast.com/t/L5gtzzwE71k

        I look forward to being of further assistance.
        Attached Files
        JimNinjaTrader Customer Service

        Comment


          #5
          OK, no surprise, you guys were right about me having multiple data sources. I thought the time would print for only one data source, even though I had multiple.

          New question - how can I specify the data source for FirstTickOfBar? Say my code is:

          Add (PeriodType.Minute, 4);
          Add (PeriodType.Minute, 5);
          Add (PeriodType.Minute, 6);
          ....
          if (FirstTickOfBar) {
          // do something....
          }

          I want the FirstTickOfBar to be calculated on the 4 minute chart, and not the 5 or 6 minute chart. How to do? Thanks

          Comment


            #6
            Originally posted by timmbbo View Post

            I want the FirstTickOfBar to be calculated on the 4 minute chart, and not the 5 or 6 minute chart. How to do? Thanks

            https://ninjatrader.com/support/help...inprogress.htm

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by guvenators, Today, 05:18 PM
            1 response
            13 views
            0 likes
            Last Post NinjaTrader_ShawnB  
            Started by LANwarr1or, Today, 03:00 PM
            2 responses
            9 views
            0 likes
            Last Post LANwarr1or  
            Started by Newtrader101, Today, 02:53 PM
            2 responses
            10 views
            0 likes
            Last Post Newtrader101  
            Started by JuanPabloQuevedo, Today, 02:53 PM
            2 responses
            9 views
            0 likes
            Last Post JuanPabloQuevedo  
            Started by samir, Today, 03:16 PM
            2 responses
            14 views
            0 likes
            Last Post samir
            by samir
             
            Working...
            X