Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8: How to get IsFirstTickOfBar on a different time frame bar

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

    NT8: How to get IsFirstTickOfBar on a different time frame bar

    I have an indicator that uses multiple time frames on a tic by tic calculated indicator & want to know when IsFirstTickOfBar occurred on one of the different time frames from the chart time frame.
    I've tried this but it doesn't work: if(BarsInProgress == 1 && IsFirstTickOfBar){ ...

    Thanks for any help.

    #2
    Hello saturntd,

    Thank you for your post.

    if(BarsInProgress == 1 && IsFirstTickOfBar){} should work. Do you receive any errors in either the log tab of the Control Center? Any errors show up in a NinjaScript Output window?

    Using prints to assess how your script is processing would be the first thing I would suggest.

    This forum post goes into great detail on how to use prints to help figure out where issues may stem from — this should get you going in the correct direction. You can even add these using the Strategy Builder.



    The above information will allow you to print out all values used in the condition in question that may be evaluating differently. With the printout information you can assess what is different between the two.

    I'd add some prints right before this part of your code and find out what BarsInProgress and IsFirstTickOfBar have for their values and see if that condition is ever becoming true.

    If you add prints and aren't sure what they're showing you, I'd be happy to assess your prints and a reduced version of your code to assist you.

    Thanks in advance; I look forward to assisting you further.

    Comment


      #3
      Thanks for responding Kate.
      I don't get any errors but it just triggers on every single tic of the chart time frame. The BarsArray[1] is a much larger time frame than the chart time frame so this shouldn't happen.

      Comment


        #4
        Hello saturntd,

        Thank you for your reply.

        Would you be able to provide a reduced version of your strategy so I can take a look at what may be occurring? Remove any code that is not necessary to reproduce the behavior.

        Thanks in advance; I look forward to assisting you further.

        Comment


          #5
          Kate,
          I notice I get different results depending on if I have tick replay checked on for the chart dataseries. Any idea why that would be?
          For a similar indicator that calculates at close of bar I had to have tick replay on otherwise I got terrible results. For the tic by tic indicator it's much better with tick replay off.

          Comment


            #6
            Originally posted by saturntd View Post
            Thanks for responding Kate.
            I don't get any errors but it just triggers on every single tic of the chart time frame. The BarsArray[1] is a much larger time frame than the chart time frame so this shouldn't happen.
            Sounds like you may have a spurious semi-colon on an if-condition, turning the filter into a null condition.

            Comment


              #7
              Hello saturntd,

              Thank you for your reply.

              I would check for the situation koganam suggested. I'm still happy to take a look at your logic if you provide a reduced version of the strategy.

              Thanks in advance; I look forward to assisting you further.

              Comment


                #8
                Click image for larger version

Name:	skimmer_no tic replay.png
Views:	147
Size:	163.6 KB
ID:	1335310I also terrible results without tic replay enabled and am confused why i get such bad results without as shown below. Click image for larger version  Name:	skimmer_ tic replay.png Views:	0 Size:	160.8 KB ID:	1335309
                Attached Files
                Last edited by Dudley; 02-19-2025, 07:51 PM.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                556 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                324 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
                545 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                547 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X