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

Ticks in a historical bar.

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

    Ticks in a historical bar.

    How can I determine the number of ticks in a historical bar on a one minute chart (for example)?
    Thank you.

    #2
    Hello higler,

    To find the amount of ticks from the high to the low.
    Code:
    (High[0] - Low[0]) / TickSize
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I am trying to determine how many trades (ticks) occurred on a historical bar. I don't think the calculation provided will give me what I am looking for. Thank you.

      Comment


        #4
        Hi higler,

        I understand. You are not looking for the number of ticks for the size of that bar, you are wanting the volume from that bar.

        Print(Volume[0]);

        The Volume dataseries has the volume for each bar.

        Below is a link to the help guide on Volume.
        http://ninjatrader.com/support/helpG...t7/volume2.htm
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I think that I am not being clear. From the NT help, "A Tick bar is based on a specific number of trades (ticks)." I am using a minute bar but want to know how many ticks (trades) occurred in a historical minute bar. I am trying to get something equivalent to Bars.TickCount that can be applied to a historical bar instead of just the current bar. The number or trades (ticks) in a bar is usually different than volume because one trade (tick) can be of more than one contract or share.

          Comment


            #6
            Hello higler,

            The volume represents the number of contracts that were traded during that bar.

            Try adding the VOL indicator to a chart. Is this not the information you are looking for?


            If you want a tick counter instead of using the volume (number of contracts traded) for a time based bar, you would need to add a secondary series to your script of 1 tick and then count each tick.

            A int variable would be used as a counter. This counter would increment when BarsInProgress is equal to 1 (so this only increments on the tick series). After a primary bar closes, save this value from the counter to a custom data series synced with the primary bar series and then reset the counter.

            Add - http://ninjatrader.com/support/helpGuides/nt7/add3.htm
            BarsInProgress - http://ninjatrader.com/support/helpG...inprogress.htm
            DataSeries - http://ninjatrader.com/support/helpG...ries_class.htm
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Thanks. I was afraid it would be something like that. I was hoping for something simple like Bars.TickCount[6] to give me the tick count of a bar six bars back.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by kaywai, Today, 06:26 AM
              1 response
              2 views
              0 likes
              Last Post kaywai
              by kaywai
               
              Started by ct, 05-07-2023, 12:31 PM
              6 responses
              202 views
              0 likes
              Last Post wisconsinpat  
              Started by kevinenergy, 02-17-2023, 12:42 PM
              118 responses
              2,778 views
              1 like
              Last Post kevinenergy  
              Started by briansaul, Today, 05:31 AM
              0 responses
              9 views
              0 likes
              Last Post briansaul  
              Started by traderqz, Yesterday, 12:06 AM
              11 responses
              28 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Working...
              X