Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trade size of tick

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

    Trade size of tick

    Hi,

    I'm trying to figure out the right way to log trade size per tick. I am running with calculate on bar close set to false, so onbarupdate is called every tick.

    Can you confirm, does Volume[0] hold the volume for the tick, or the whole bar in progress? If for the whole bar, I need to record this value then subtract from current to calculate difference and thus tick volume/trade size?

    Thanks.

    #2
    Hello pjsmith,

    Thank you for your inquiry.

    Volume[0] would hold the volume of the entire bar in progress. You can demonstrate this by adding a VOL indicator to the chart you are running the strategy on, with Calculate on Bar Close set to false, and compare the values between the two.

    Both the strategy and the indicator will show the same values.

    If you would like to calculate the volume for each tick of data that comes in, you could add a secondary Bars object and only run your code when that particular Bars object calls OnBarUpdate().

    Example:
    Code:
    protected override void Initialize()
    {
         Add(PeriodType.Tick, 1);
    }
    
    protected override void OnBarUpdate()
    {
         if (BarsInProgress == 1) // if the second Bars object has called OnBarUpdate()
              Print(Volumes[1][0]); // print the volume of the tick series
    }
    The NinjaTrader help guide provides further information about this subject in the Multi-Time Frame & Instruments section: http://ninjatrader.com/support/helpG...nstruments.htm

    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Hi,

      Thank you. For clarity, with CalculateOnBarClose set to false, is not onbarupdate called every tick, regardless of the primary instrument data period?

      Comment


        #4
        Hello pjsmith,

        Yes, this is correct. With CalculateOnBarClose set to false, OnBarUpdate() will be called on every tick of data that comes in rather than on bar close.

        However, calling Volume[0] on a one minute Data Series, for example, will be returning the volume of the actual one minute bar itself, not the tick that comes in.

        To further demonstrate this, try printing Time[0] with CalculateOnBarClose set to false on a one minute bar. You will notice that the time will be the same until the bar closes and the next bar starts forming. The print is returning the minute bar time and not the time of the ticks coming in.
        Zachary G.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        566 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        330 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        547 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        548 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X