• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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, 02: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 aninlies, Today, 12:14 AM
          0 responses
          3 views
          0 likes
          Last Post aninlies  
          Started by sledge, 11-28-2018, 08:42 AM
          2 responses
          79 views
          0 likes
          Last Post aligator  
          Started by imalil, Yesterday, 09:50 PM
          0 responses
          2 views
          0 likes
          Last Post imalil
          by imalil
           
          Started by rtwave, Yesterday, 07:06 PM
          0 responses
          11 views
          0 likes
          Last Post rtwave
          by rtwave
           
          Started by patpat, Yesterday, 04:25 PM
          4 responses
          11 views
          0 likes
          Last Post patpat
          by patpat
           
          Working...
          X