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

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 Kaledus, Today, 01:29 PM
                0 responses
                3 views
                0 likes
                Last Post Kaledus
                by Kaledus
                 
                Started by PaulMohn, Today, 12:36 PM
                1 response
                16 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by yertle, Yesterday, 08:38 AM
                8 responses
                36 views
                0 likes
                Last Post ryjoga
                by ryjoga
                 
                Started by rdtdale, Today, 01:02 PM
                1 response
                6 views
                0 likes
                Last Post NinjaTrader_LuisH  
                Started by alifarahani, Today, 09:40 AM
                3 responses
                18 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Working...
                X