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

How to Test for the FirstTickOfBar for a Higher Time Frame Bar CurrentBars[1]

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

    How to Test for the FirstTickOfBar for a Higher Time Frame Bar CurrentBars[1]

    Hi,
    I have an Indicator that plots the possible closes for the Current UniRenko Bar, for Both the Chart time frame and also a Higher time frame (Ex. 4 Tick and a 8 Tick)

    I would like to know how to test the for the FirstTickOfBar of the Higher time frame?

    This did not work: if ( CurrentBars[1] == FirstTickOfBar[1] )

    And

    This Also did not work: if ( BarsInProgress[1] == FirstTickOfBar[1] )

    Thank You.
    Joe
    Last edited by jmca2000; 01-17-2020, 03:19 PM.

    #2
    Hello jmca2000,

    Thank you for your note.

    You could structure that like this: (note this assumes you only have 1 additional data series added to the script)

    Code:
    if(BarsInProgress == 1) //this makes sure we're only looking at the secondary series
    {
         if (FirstTickOfBar) //check if it's the first tick of the bar
         {
              //Do something 
         }
    }
    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hi Kate,

      Thank You for your reply...

      Will your code "Do something" ONLY If it is the First Tick of the BarsInProgress == 1 and NOT "Do Something" if it's the FirstTickOfBar of the BarsInProgress == 0 ...?

      I just want the code to "Do Something" if it's the First Tick of the Bar for BarsInProgress == 1

      Thank You Again and in Advance...

      Joe

      Comment


        #4
        Hello jmca2000,

        Thank you for your reply.

        Yes, because I've nested the first tick of bar check inside the bars in progress check, it will first make sure that we're processing that secondary series, then check to see if the incoming tick is the first tick of a new bar for that secondary series.

        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Thank You Again Kate...

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by algospoke, Yesterday, 06:40 PM
          2 responses
          19 views
          0 likes
          Last Post algospoke  
          Started by ghoul, Today, 06:02 PM
          3 responses
          14 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by jeronymite, 04-12-2024, 04:26 PM
          3 responses
          45 views
          0 likes
          Last Post jeronymite  
          Started by Barry Milan, Yesterday, 10:35 PM
          7 responses
          20 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by AttiM, 02-14-2024, 05:20 PM
          10 responses
          181 views
          0 likes
          Last Post jeronymite  
          Working...
          X