• 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

Tick Counter Indicator

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

    Tick Counter Indicator

    Is there a way to display time/ticks remaining in bar.

    Thanks,
    Jason

    #2
    imported post

    If you have some programming skill, you can create an indicator to do this using NinjaScript.

    Ray
    RayNinjaTrader Customer Service

    Comment


      #3
      imported post

      I can probably do that. Is there a class that has the info I need or do I need to keep track of time/ticks in OnBarUpdate()?

      Thanks,

      Jason

      Comment


        #4
        imported post

        You need to create a variable outside of the OnBarUpdate() method and increment it in the OnBarUpdate() method.

        Maybe something like:

        // Variables
        private int tickCount = 0;
        private int activeBar = 0;

        OnBarUpdate()
        {
        if (CurrentBar != activeBar)
        {
        activeBar = CurrentBar;
        tickCount = 0;
        }

        tickCount++;

        Plot0.Set(tickCount);
        }


        RayNinjaTrader Customer Service

        Comment


          #5
          imported post

          That's what I thought, but OnBarUpdate() does not seem to be called for every tick.

          I have this:
          protected override void OnBarUpdate()
          {
          if (CurrentBar != currentBarHold) {
          Print("Bar Close: " + ticks);
          currentBarHold = CurrentBar;
          ticks = 0;
          }
          ticks++;
          }

          Using the simulated data feed with 133 tick interval produces:
          Bar Close: 54
          Bar Close: 71
          Bar Close: 70
          Bar Close: 76
          Bar Close: 72
          Bar Close: 67
          Bar Close: 53

          I had similar results with IB data feed as well.


          Comment


            #6
            imported post

            We are looking into it and will get back to you tomorrow. Our head of development is out today.

            Ray
            RayNinjaTrader Customer Service

            Comment


              #7
              imported post

              Just an update:

              I did confirm that tick bars are being built correctly so the issue for sure in the firing of the OnBarUpdate() method. This will be investigated tomorrow.

              Ray
              RayNinjaTrader Customer Service

              Comment


                #8
                imported post

                Here is the deal:

                Chart visualization is optimized and we filter out ticks that would not impact a visual change to the chart. We have some connectivity providers that send a lot of ticks and without this optimization NT would be extremely CPU intensive.

                What can be done?

                We can expose a TickCount property that you could access? You could then implement an indicator that custom draws the tick count. See the attached indicator and the Plot() method to custom draw a string.
                Attached Files
                RayNinjaTrader Customer Service

                Comment


                  #9
                  imported post

                  Thanks! Do you have any idea when TickCount might be implemented. I could work on the indicator, but it might take a while. Not a lot of spare time these days.

                  By the way, I am really impressed with NinjaTrader and your prompt responses.

                  Thanks,
                  Jason

                  Comment


                    #10
                    imported post

                    You can use the one I created that is attached to this post. You will have to upgrade to 5.1.1000.2 which can be downloaded from the link below. This version is not yet published on our website.

                    www.ninjatrader-support.com/ninjatrader/nt5/NinjaTrader.Install.new.msi


                    Attached Files
                    RayNinjaTrader Customer Service

                    Comment


                      #11
                      imported post

                      That works great!

                      I made a couple enhancements to TickCounter:

                      The user can choose for it to count up or down.
                      The text will change colors in the last 20% of the bar.
                      The user can select the two text colors.

                      If I have time this weekend, I'll see if I can make it work for minute charts as well.
                      Attached Files

                      Comment


                        #12
                        imported post

                        Cool, looks good.
                        RayNinjaTrader Customer Service

                        Comment


                          #13
                          imported post

                          I added seconds count for minute charts.

                          Is there a way to put a panel to the right of the chart with price, time left in bar, etc?
                          Like what you see in many Woodies CCI charts?

                          Attached Files

                          Comment


                            #14
                            imported post

                            Cool.

                            There is no way to custom draw in the margins.

                            Ray
                            RayNinjaTrader Customer Service

                            Comment


                              #15
                              imported post

                              I just downloaded Tick Counter and tried to install it and got the follwing error message:

                              NinjaTrader Data Bars does not contain a definition for TickCount.

                              There is no Tick Counter indicator in my charts when I open one. I have had no problem with installing the other custom indicators.

                              cheers,

                              Antramam


                              0

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by futurestrader7, Today, 11:31 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post futurestrader7  
                              Started by Teebone21, Today, 10:38 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post Teebone21  
                              Started by J_o_s, 03-30-2020, 12:29 AM
                              2 responses
                              16 views
                              0 likes
                              Last Post J_o_s
                              by J_o_s
                               
                              Started by ptpatrader, Today, 10:27 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post ptpatrader  
                              Started by albertokeira, Today, 09:30 AM
                              0 responses
                              8 views
                              0 likes
                              Last Post albertokeira  
                              Working...
                              X