Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

FirstTickofBar for Volume

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

    FirstTickofBar for Volume

    Hello NinjaTrader!

    For the life of me I cannot firgure out how to get the first tick of bar for volume chart(s). I've read the tip in the NinjaTrader 8 documentation:
    Tip:

    In NinjaTrader's event driven framework, bar closures are signaled by the tick that opens the next bar. The price of the last tick of a bar can be referenced by checking Close[1] on IsFirstTickOfBar. For volume and tick based bars, Bars.TickCount and Volume[0] can be referenced to see if the number of ticks / volume meet the criteria to build a new bar.


    I need help issuing the correct command to get the first tick of Volume Bar. Any help would be appreciated.

    Thank you​

    #2
    Hello geekodude,

    Rather than using the items from that description you could do the same concept as the BuySellVolume indicator which uses the CurrentBar index to know when a new bar is created. The first tick which is received that creates a new bar will increment the CurrentBar index. A simple condition can be used to check if the index of the CurrentBar is greater than a stored variable. The script would need to be run OnEachTick in realtime.


    Code:
    private int activeBar = 0;
    protected override void OnBarUpdate()
    {​
       if (CurrentBar != activeBar)
       {
          //your first tick of bar logic here
          activeBar = CurrentBar;
       }​
    }

    Comment


      #3
      Hello Jesse:

      This works Thank you! :-)

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      571 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
      548 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      549 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X