Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw TimeSpan

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

    #16
    Originally posted by dsraider View Post
    Ugh. I spoke too soon. What I'm trying to do is measure the time between actual trades and draw that on a chart as an indicator. While it now draws, it doesn't update from bar to bar as you can see by the pic below.
    While I hesitate to say that is impossible, we have to be cognizant of the constraints of the platform. Chart presentation is gated by the barSeries, which is totally independent of market updates, so it would be technically impossible using the NT framework as designed, to plot on a chart the characteristics of trade times, independently of the barSeries updates. At best, what you would see on the chart at any time is the time elapsed since the close of the last bar, up to the current trade.

    OTOH, since you can drawText to the chart, independent of the barSeries, it would be possible to print to the chart the time between trades. Whether the printout will ever be readable in any normally liquid market is a different kettle of fish.

    Comment


      #17
      Originally posted by dsraider View Post
      And which just started working without making any changes (cue horror music).
      That is just the programming gods up to their usual chicanery. Just as long as you realize what you are actually seeing, and be sure that it is sync with what you think you wanted to see.

      Comment


        #18
        Oh I see what you're saying. Needed to switch to a longer timeframe in order to check but you're absolutely right. Weird because I was able to duplicate the T&S window and figured I'd be able to simply measure the span between timestamped trades. Stubborn ox that I am, I still think it's possible, so I'll keep trying. In the meantime, I guess I'd better get used to 1 tick charts

        Comment


          #19
          Follow-up question...

          In post #14, I show how my plot is "not working correctly." In # 15, I retract my statement. What's actually happening is the plot is so unbelievably high during the first bar that it doesn't allow the bars thereafter to scale properly (at least not to the human eye). Once bar one is off screen, the scaling begins to "work."

          My guess is the initial calculation is using a bar from a long time ago (Jan 1st, maybe?), which would explain its high number. Since this calculation is supposed to reflect time in milliseconds since the beginning of the current bar, is there anything I can add to the code to ensure that?

          if(Historical) return;
          BarsRequired = 1;

          both did nothing.

          Comment


            #20
            Hello dsraider,
            Thanks for your post.

            In absence of the code its difficult to say anything. From the screenshot it appears that the values are calculating in realtime. So Historical or BarsRequired wont do any good.

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

            Comment


              #21
              Originally posted by dsraider View Post
              Follow-up question...

              In post #14, I show how my plot is "not working correctly." In # 15, I retract my statement. What's actually happening is the plot is so unbelievably high during the first bar that it doesn't allow the bars thereafter to scale properly (at least not to the human eye). Once bar one is off screen, the scaling begins to "work."

              My guess is the initial calculation is using a bar from a long time ago (Jan 1st, maybe?), which would explain its high number. Since this calculation is supposed to reflect time in milliseconds since the beginning of the current bar, is there anything I can add to the code to ensure that?

              if(Historical) return;
              BarsRequired = 1;

              both did nothing.
              Use OnStartUp() to set all your dataSeries to initial values to use as the starting base, then return. That way bar1 will be counting all things from bar0, not from some uninitialized, imprecisely defined starting state.

              Comment


                #22
                koganam,

                You rock.

                Thanks

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by larkmail, Today, 12:30 PM
                1 response
                5 views
                0 likes
                Last Post NinjaTrader_Kate  
                Started by omermirza, Today, 12:39 PM
                0 responses
                5 views
                0 likes
                Last Post omermirza  
                Started by Danila, Today, 11:08 AM
                1 response
                11 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by dbida001, Today, 10:31 AM
                1 response
                5 views
                0 likes
                Last Post NinjaTrader_ChristopherJ  
                Started by Brandon9821, Today, 08:27 AM
                3 responses
                30 views
                0 likes
                Last Post Brandon9821  
                Working...
                X