Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Chart stepping: tick-by-tick or bar-by-bar possible?

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

    Chart stepping: tick-by-tick or bar-by-bar possible?

    Hi all,

    I'm new to NT. I have a software development background, and know C#.

    I'm wondering if it's possible to see a chart get updated on each tick or bar. My interest is mainly for development, so I can see the graphical output of an Indicator at various points along the chart, before it reaches the end and its final appearance/state.

    Possible? I've been relying on writing selected Indicator values to a file as a midway snapshot, then opening them in perl/python to generate a chart. Takes too much time, I'd really like to find a solution within NT.

    Thanks,
    -Plaus

    #2
    Hello,

    Thank you for your post and welcome to our forums!

    Most of the calculation of a NinjaScript indicator are done in the OnBarUpdate() event handler, which can be called with every new bar, or on each coming tick, depending on your CalculateOnBarClose settings.

    Please see our Help Guide article on OnBarUpdate() for more information:



    If you're familiar with C#, you should find NinjaScript very easy use. We have a fully documented help guide which will help you get started with Ninja Script. You will find language references to all of the methods and functions you will be using. You will also see a tutorial section which will help you create your first indicator and get you started with some of these concepts.

    A link to our Help Guide can be found below: http://www.ninjatrader.com/support/h...stribution.htm
    MatthewNinjaTrader Product Management

    Comment


      #3
      Thanks for your swift reply, @NinjaTrader_Matthew.

      I have seen that OnBarUpdate() is the main event handler for customization during chart drawing.

      What I hope to get from this thread is whether it's possible to see the chart at any arbitrary point in CurrentBar, preferably interactively.

      So, ideally, being able to navigate a chart through time, like a movie, forwards or backwards, to see bars and indicators appear after each OnBarUpdate().

      Thanks,
      -plaus

      Comment


        #4
        Mouse scroll wheel, left/right cursor keys for single bar movement, and also clicking below and dragging the chart should work too.

        Originally posted by plausible_deniability View Post
        Thanks for your swift reply, @NinjaTrader_Matthew.

        I have seen that OnBarUpdate() is the main event handler for customization during chart drawing.

        What I hope to get from this thread is whether it's possible to see the chart at any arbitrary point in CurrentBar, preferably interactively.

        So, ideally, being able to navigate a chart through time, like a movie, forwards or backwards, to see bars and indicators appear after each OnBarUpdate().

        Thanks,
        -plaus

        Comment


          #5
          If you scroll back on the chart and then advanced the chart using your cursor, you will see the indicators update on each bar close.

          If you want intrabar updates, you can use our market replay feature to see these calculations occur in real-time.

          Market Replay works if you have downloaded or recorded market replay data.

          Please click here for detailed instructions on downloading and recording market replay data
          MatthewNinjaTrader Product Management

          Comment


            #6
            I've learned how to scroll the chart.

            I guess what I'm looking for is a little different - if my chart is N bars long/wide, I want to redraw the chart for 1..M, where M is between 2..N-1.

            I think what we get in NT is charts that are drawn just once. I want to draw a part of a chart.

            My motivation is that I suspect certain indicators are changing their results as time moves on. To test this, I've dumped the data available at OnBarUpdate() and rerun indicators bar-by-bar programmatically.

            Then I charted the result in Perl. There I saw the indicator plots change, depending on what the end bar or date was.

            I'd much rather do interactive chart stepping through NT, though.

            Thanks,
            -plaus

            Comment


              #7
              Originally posted by plausible_deniability View Post
              I've learned how to scroll the chart.

              I guess what I'm looking for is a little different - if my chart is N bars long/wide, I want to redraw the chart for 1..M, where M is between 2..N-1.

              I think what we get in NT is charts that are drawn just once. I want to draw a part of a chart.

              My motivation is that I suspect certain indicators are changing their results as time moves on. To test this, I've dumped the data available at OnBarUpdate() and rerun indicators bar-by-bar programmatically.

              Then I charted the result in Perl. There I saw the indicator plots change, depending on what the end bar or date was.

              I'd much rather do interactive chart stepping through NT, though.

              Thanks,
              -plaus
              Would Market Replay help? You can pause in there, but you can't 'reverse'. You can only set the start time.

              What specifically where you looking at indicator wise that it 'changed'?

              There is also calculate on bar close which can be true or false. If false, it updates on every tick, so an indicator is recomputed. If true, it only updates on bar close and before a new bar is painted.

              About the only thing you can do to redraw the chart is F5 to reload historical data.

              "So, ideally, being able to navigate a chart through time, like a movie, forwards or backwards, to see bars and indicators appear after each OnBarUpdate()."

              That's not going to happen via the program. About the only thing you could do would be to put a wait loop to wait 5 seconds on each tick. That would be scary though.

              Comment


                #8
                Originally posted by plausible_deniability View Post
                I've learned how to scroll the chart.

                I guess what I'm looking for is a little different - if my chart is N bars long/wide, I want to redraw the chart for 1..M, where M is between 2..N-1.

                I think what we get in NT is charts that are drawn just once. I want to draw a part of a chart.

                My motivation is that I suspect certain indicators are changing their results as time moves on. To test this, I've dumped the data available at OnBarUpdate() and rerun indicators bar-by-bar programmatically.

                Then I charted the result in Perl. There I saw the indicator plots change, depending on what the end bar or date was.

                I'd much rather do interactive chart stepping through NT, though.

                Thanks,
                -plaus
                I was thinking you could use the iDataSeries and populate a new series.

                Say you populate it with 20 bars starting at bar 50.
                EMA(6) would be the same on that series or the other series starting at bar 50.

                Then you get into issues that the next OnBarUpdate() pushes a new item onto the 'stack'.

                Some of that discussion can be seen here: http://www.ninjatrader.com/support/f...ht=iDataSeries

                What kind of bars are you using? Minute? Range?

                Comment


                  #9
                  Good suggestions @sledge, I'll check these out now.

                  It's a proprietary indicator I'm debugging on behalf of another person, so there's the possibility that as CurrentBar increments with each call to OnBarUpdate(), the indicator's computation to the left of CurrentBar may change, due to a coding glitch, or overlap in the algorithm across bar steps - whatever.

                  I see that this is happening when I look at my Perl-based charts, and-

                  1) want to speed up the debug cycle by not going to Perl anymore (yes I am using CLR Debugger, thanks to other posts found here),

                  2) I want to understand the Indicator and whether it has a bug, then

                  3) repair or replace it. :-)

                  Thanks,
                  plaus

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Aviram Y, Today, 05:29 AM
                  3 responses
                  10 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by algospoke, 04-17-2024, 06:40 PM
                  3 responses
                  26 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Started by bmartz, 03-12-2024, 06:12 AM
                  3 responses
                  30 views
                  0 likes
                  Last Post NinjaTrader_Zachary  
                  Started by gentlebenthebear, Today, 01:30 AM
                  1 response
                  8 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Started by cls71, Today, 04:45 AM
                  1 response
                  7 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Working...
                  X