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

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;
       }​
    }
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello Jesse:

      This works Thank you! :-)

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by futtrader, Today, 01:16 PM
      0 responses
      4 views
      0 likes
      Last Post futtrader  
      Started by Segwin, 05-07-2018, 02:15 PM
      14 responses
      1,789 views
      0 likes
      Last Post aligator  
      Started by Jimmyk, 01-26-2018, 05:19 AM
      6 responses
      838 views
      0 likes
      Last Post emuns
      by emuns
       
      Started by jxs_xrj, 01-12-2020, 09:49 AM
      6 responses
      3,294 views
      1 like
      Last Post jgualdronc  
      Started by Touch-Ups, Today, 10:36 AM
      0 responses
      13 views
      0 likes
      Last Post Touch-Ups  
      Working...
      X