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

Is MAX() function inclusive?

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

    Is MAX() function inclusive?

    Hi,

    Does:

    MAX(High,1)[1]

    Return yesterday's high, or the day before yesterday's high?

    thanks,
    RK142

    #2
    Hi RK,

    [0] is always the current bar (whether completed or not), so [1] is the prior bar. Thus, your syntax will refer to what the MAX value was 1 bar ago.

    Comment


      #3
      What coolmoss said is correct. Your calculate on bar close setting will determine if it refers to the prior bar's high or the bar before that. This would only refer to daily bars if you were currently operating on a daily chart



      If you just wanted the prior high you could use

      High[x]// where x is the bars ago value


      Let me know if I can further assist.
      LanceNinjaTrader Customer Service

      Comment


        #4
        Thank you both.

        I understand how to call the prior High, but what I'm doing is a little trickier than that, and it will help me to implement my logic if I understand whether:

        Max(High,1)[1]

        Is equivalent to

        High[1], or
        High[2].

        Which one?

        -RK142

        Comment


          #5
          In this specific case it would return the same value as High[1]

          You can confirm this by sending a print to the output window (tools -> output window)

          Print(High[1]);
          Print(Max(High,1)[1]);

          Let me know if I can further assist.
          LanceNinjaTrader Customer Service

          Comment


            #6
            Thanks!

            -RK

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by cre8able, 02-11-2023, 05:43 PM
            3 responses
            236 views
            0 likes
            Last Post rhubear
            by rhubear
             
            Started by frslvr, 04-11-2024, 07:26 AM
            8 responses
            114 views
            1 like
            Last Post NinjaTrader_BrandonH  
            Started by stafe, 04-15-2024, 08:34 PM
            10 responses
            47 views
            0 likes
            Last Post stafe
            by stafe
             
            Started by rocketman7, Today, 09:41 AM
            3 responses
            11 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by traderqz, Today, 09:44 AM
            2 responses
            10 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Working...
            X