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

Bar after bool is true

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

    Bar after bool is true

    Hi All,

    How do I reference a bar which immediately follows a bar where a bool is true. That is, if during current bar, the bool becomes true, I would like to refer to the bar following that bar and by referring, I mean access the open, high, low and close of that bar.

    Regards

    Kay Wai

    #2
    Hello Kay,

    Thank you for your post.

    You can use FirstTickOfBar and the Bool together to get the next bar has been created and then you can access those values.

    Let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Hi Cal,

      Thank you for your quick reply.
      1) FirstTickOfBar is genrally used where cobc = false, right?
      2) if i want, for example, to compare the high of the bar following the bar where the bool became true to the high of the bool bar or to the high of the bar before the bool, and this comparison can only be made if the bool bar is true, how would i go about doing that?

      Perhaps i'm overthinking this but it feels complicated to me. Ideally if there was a High[-1] or something to that effect, maybe that would make it a lot easier though i'm not too sure either.

      Regards
      Kay Wai

      Comment


        #4
        Kay,

        Correct, this is generally used with COBC set to false.

        I think I see the purpose what you are trying to achieve.

        While this would be plausible in a back test with historical data, it would not work in a live situation as there is no -1 bar index in this case.

        Is this bool mean't to be become true in a live situation?
        Or are you looking at this historically?
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          Hi Cal,

          This bool is meant to become true in a live situation. The following bar must then meet certain criteria before an entry can be made.

          Regards

          Kay Wai

          Comment


            #6
            Kay,

            Then the FirstTickOfBar will be what you are looking for. We would run this for COBC = false, so that when your bool becomes true we are still waiting for the next bar to start, which is where FirstTickOfBar comes in handy.

            Let me know if I can be of further assistance.
            Cal H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by GussJ, 03-04-2020, 03:11 PM
            16 responses
            3,279 views
            0 likes
            Last Post Leafcutter  
            Started by WHICKED, Today, 12:45 PM
            2 responses
            19 views
            0 likes
            Last Post WHICKED
            by WHICKED
             
            Started by Tim-c, Today, 02:10 PM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by Taddypole, Today, 02:47 PM
            0 responses
            5 views
            0 likes
            Last Post Taddypole  
            Started by chbruno, 04-24-2024, 04:10 PM
            4 responses
            51 views
            0 likes
            Last Post chbruno
            by chbruno
             
            Working...
            X