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 algospoke, Today, 06:40 PM
            0 responses
            2 views
            0 likes
            Last Post algospoke  
            Started by maybeimnotrader, Today, 05:46 PM
            0 responses
            6 views
            0 likes
            Last Post maybeimnotrader  
            Started by quantismo, Today, 05:13 PM
            0 responses
            6 views
            0 likes
            Last Post quantismo  
            Started by AttiM, 02-14-2024, 05:20 PM
            8 responses
            168 views
            0 likes
            Last Post jeronymite  
            Started by cre8able, Today, 04:22 PM
            0 responses
            8 views
            0 likes
            Last Post cre8able  
            Working...
            X