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 volume - the sum of ticks in a given time period

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

    Tick volume - the sum of ticks in a given time period

    Hello There,

    I'm not a really good programmer and I was wondering if some of you will be able to help me to start my project.

    I want to develop an indicator showing as an histogram the tick volume : the sum of ticks in a given time period, a bar.
    I also would like to color the histogram bars, if the volume bar is lower than the previous bar, it will be red and green for the opposite.

    Any kind of idea to help me to start will be very appreciated.
    Thank you in advance and all the best.
    J.
    Last edited by jed77; 02-03-2009, 04:56 AM.

    #2
    Hi jed77, you will need to create some logic that tracks the ticks occurred on the bar for you, here's a thread where the same topic was discussed - http://www.ninjatrader-support2.com/...ad.php?t=10900

    For additional programming tutorials, you can check out those - http://www.ninjatrader-support.com/H...verview18.html

    If you need this tool professionally programmed, you can contact those NinjaScript consultants - http://www.ninjatrader.com/webnew/pa...injaScript.htm
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Jed: I have no experience programming Ninja, but will let you know if I figure out anything.


      Questions for Bertrand:
      (1) Can this indicator only be created with real time data (not historically)?

      (2) I noticed that IQFEED provides "Number of Trades Today" (see http://www.iqfeed.net/index.cfm?disp...r&section=main). Would it be possible to use this for Ninja EOD charts?


      Thanks.

      Comment


        #4
        1. If you want to program it on real-time data only you can.

        2. Unfortunately this is not supported.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Hello,

          I started to code a bit... And I think I'm very close... I just don't know why my histogram does not appear....

          If somebody can have a look at the code Please....

          First, the variables :
          Code:
           #region Variables
                  // Wizard generated variables
                  // User defined variables (add any user defined variables below)
                  
                  private DataSeries TickVolDatas; // Define a DataSeries variable 
                  #endregion
          Then :
          Code:
                  protected override void Initialize()
               
            {
                      CalculateOnBarClose    = false;
                      Overlay                = false;
                      PriceTypeSupported    = false;
                      
                      TickVolDatas = new DataSeries(this);     // "this" refers to the indicator, or strategy 
                                                               // itself. This syncs the DataSeries object 
                                                               // to historical data bars 
                      
                      Add(new Plot(Color.Blue, PlotStyle.Bar, "TickVolDatas"));  
          
                      
                  }
          
                  /// <summary>
                  /// Called on each bar update event (incoming tick)
                  /// </summary>
                  protected override void OnBarUpdate()
                  {
                      // To avoid the"index out of range" :
                      if (CurrentBar < 0)
                               return;
                      
                      // Prints the tick count to the output window 
                      //Print("The tick count of the current bar is " + Bars.TickCount.ToString());
                      
                      // calculate the tick count of the current bar and set the value 
                      TickVolDatas.Set(Bars.TickCount); 
                      Print("The tick count of the current bar is " + TickVolDatas);
                      
                  }
          The tick count appear in the output and seems right, but no bar on the histogram.... Any idea ?

          Thank you very much.
          J.

          Comment


            #6
            jed77, working through the custom indicator tutorials to get a feel for how this works.

            Currently, don't have the knowledge to help you with your code.

            Comment


              #7
              There is a Cumulative tick indicator here:



              Here is it after I hacked it to show Total tick per bar. I did not remove any of the other code to clean it up so careful if you change any settings cause I do not know what it will show then, but I know it works if you just throw it on a chart without changing the setting.

              Notice how the ticks produce a very similar pattern to volume. And you can use it on a volume bar chart where a volume indicator would be useless.

              It only works on Live data and going forward in time, not on history.

              Dean.
              Attached Files

              Comment


                #8
                Thank you very much Dean !

                This seems working very well. I'll make some test to be sure of the indicator, but it looks good.

                For learning reasons, I want to improve my programing skills, I'll continue anyway to develop my own.
                Is there somebody to help me to plot the values as an histogram ? I looked at the tutorials, but my mind does not click yet....
                Thank you very much for all of your help !
                J.

                Comment


                  #9
                  Hi jed77, please post the latest revision of your code and we will have a look. Thanks!
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    Thank you Bertrand,

                    The code is few messages below, here :


                    I tried to look at the tutorials, but couldn't figure out how to do the histogram.....
                    All the best
                    J.

                    Comment


                      #11
                      Thanks jed77, Bars.TickCount has no history, it will give you the current tickcount of the currently developing bar, so this the explanation why you don't see the histogram you are looking for.

                      You can check out this thread, where some logic was developed to get up/dntick data - http://www.ninjatrader-support2.com/...ad.php?t=10900
                      BertrandNinjaTrader Customer Service

                      Comment


                        #12
                        yes Bertrand, I know there's no history for Tickcount. But I tried it on 1 min chart and waited for several bars
                        Also, the count is well visible in the output window.

                        The problem is to put that count on an histogram. Something must be wrong in my code... I read the link you gave me already, but I'm kind of lost there...

                        Is it possible for you to have a look at my code please ?

                        All the best.
                        J.

                        Comment


                          #13
                          Hi jed77, your code is ok, but you will need to create a history yourself as the Bars.TickCount only supplies the latest tickcount of the currently developing bar. You can see this if you plot the outcome on a chart and hit F5 to refresh multiple times with in the bar.

                          Unfortunately I cannot custom code your indicator as we don't have the bandwith for that, but you can try using the code provided in the other thread I supplied to achieve your goal.

                          If you need this professionally programmed for you, consider contacting a NinjaScript consultant - http://www.ninjatrader.com/webnew/pa...injaScript.htm
                          BertrandNinjaTrader Customer Service

                          Comment


                            #14
                            Originally posted by deanz View Post
                            There is a Cumulative tick indicator here:



                            Here is it after I hacked it to show Total tick per bar. I did not remove any of the other code to clean it up so careful if you change any settings cause I do not know what it will show then, but I know it works if you just throw it on a chart without changing the setting.


                            Dean.
                            Dear Dean,

                            I'm a beginner programmer and I trying to train myself... Do you mind to remove the unnecessary code ? I really would like to wrap my mind around that logic....
                            Also, I want to use this code inside another indicator....
                            If it is not to much trouble....
                            Thank you very much for your help !
                            All the best.
                            J.

                            Comment


                              #15
                              J this is as simple as I can make it :-)

                              Also did you see this link in the Ninja Script lessons:
                              Discover CISIN, a top-rated software company specializing in developing IT services and solutions. Trust us for expert software development and cutting-edge technology.


                              Dean.
                              Attached Files

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by pibrew, Today, 06:37 AM
                              0 responses
                              0 views
                              0 likes
                              Last Post pibrew
                              by pibrew
                               
                              Started by rbeckmann05, Yesterday, 06:48 PM
                              1 response
                              12 views
                              0 likes
                              Last Post bltdavid  
                              Started by llanqui, Today, 03:53 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post llanqui
                              by llanqui
                               
                              Started by burtoninlondon, Today, 12:38 AM
                              0 responses
                              10 views
                              0 likes
                              Last Post burtoninlondon  
                              Started by AaronKoRn, Yesterday, 09:49 PM
                              0 responses
                              15 views
                              0 likes
                              Last Post AaronKoRn  
                              Working...
                              X