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 Irukandji, Today, 09:34 AM
            0 responses
            3 views
            0 likes
            Last Post Irukandji  
            Started by TraderBCL, Today, 04:38 AM
            3 responses
            24 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by WeyldFalcon, 08-07-2020, 06:13 AM
            11 responses
            1,423 views
            0 likes
            Last Post jculp
            by jculp
             
            Started by RubenCazorla, Today, 09:07 AM
            0 responses
            4 views
            0 likes
            Last Post RubenCazorla  
            Started by BarzTrading, Today, 07:25 AM
            2 responses
            29 views
            1 like
            Last Post BarzTrading  
            Working...
            X