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

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 adeelshahzad, Today, 03:54 AM
                              4 responses
                              25 views
                              0 likes
                              Last Post adeelshahzad  
                              Started by merzo, 06-25-2023, 02:19 AM
                              10 responses
                              823 views
                              1 like
                              Last Post NinjaTrader_ChristopherJ  
                              Started by frankthearm, Today, 09:08 AM
                              5 responses
                              17 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              3 responses
                              43 views
                              0 likes
                              Last Post jeronymite  
                              Started by yertle, Today, 08:38 AM
                              5 responses
                              16 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Working...
                              X