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 geddyisodin, Today, 05:20 AM
            2 responses
            16 views
            0 likes
            Last Post geddyisodin  
            Started by hazylizard, Today, 08:38 AM
            0 responses
            6 views
            0 likes
            Last Post hazylizard  
            Started by Max238, Today, 01:28 AM
            5 responses
            42 views
            0 likes
            Last Post Max238
            by Max238
             
            Started by giulyko00, Yesterday, 12:03 PM
            3 responses
            13 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by habeebft, Today, 07:27 AM
            1 response
            16 views
            0 likes
            Last Post NinjaTrader_ChristopherS  
            Working...
            X