• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Getting the highest High of pass 3 days, for every bar.

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

    Getting the highest High of pass 3 days, for every bar.

    To illustrate it clearer, I would set a scenario:

    period: 1 day
    (assume trade 7 days a week)


    Date - Highest High in past 3 days
    1/12 - 2655
    1/13 - 2641
    1/14 - 2621
    1/15 - 2621
    1/16 - 2601
    1/17 - 2587
    1/18 - 2577
    1/19 - 2573 (current day)

    How I get highest High in past 3 days: MAX(High, 3)[0]

    Now, I am in current day (1/19). I would like to get Highest High on 1/18, 1/16, 1/14

    What I tried to get Highest in past 3 days for 1/18:
    MAX(Highs[1],3)[0]
    But apparently it is not working. Highs don't work that way.

    What other function I can use?

    Thanks.

    #2
    Hello,

    Thank you for the question.

    I see that you are running this on a 1 day chart, the code you have provided to get the highest in the last 3 days would be if you have added an additional data series to the chart.

    The following would be able to get the last 3 days from the daily chart.

    Code:
    int highestBar = HighestBar(High, 3);
    double price = High[highestBar];
    Take a look at the HighestBar in the help guide, this will tell you a little more about how this works: http://www.ninjatrader.com/support/h...=highest%2Bbar

    The Highest bar returns an amount of bars ago which is useful when using the DataSeries because you know which bar to get the data from this way so you are not limited to only the high data, if needed you can access the bars total information.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks for replying.

      I had tried the HighestBar(), it does return the highest bar in between N period from current bar, but still it is not really helpful to retrieve the info I want.

      Unless I can save the index of HighestBar in 1/14, 1/16, 1/18, and retrieve it back in 1/19, then I can get from High[index].

      Comment


        #4
        Hello,

        If you are trying to store the bars ago values for each of these dates you could take a look into an IntSeries which will allow you to store inter values in a series similar to how the price values are being stored.

        Here is some documentation on this, http://www.ninjatrader.com/support/h...tsub=IntSeries

        If you are storing the barsAgo value or the bar number of the HighestBar event you could store it into a IntSeries and then use this later to recall only these specific bar numbers.

        Please let me know if I may be of additional assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Originally posted by vhanded View Post
          To illustrate it clearer, I would set a scenario:

          period: 1 day
          (assume trade 7 days a week)


          Date - Highest High in past 3 days
          1/12 - 2655
          1/13 - 2641
          1/14 - 2621
          1/15 - 2621
          1/16 - 2601
          1/17 - 2587
          1/18 - 2577
          1/19 - 2573 (current day)

          How I get highest High in past 3 days: MAX(High, 3)[0]

          Now, I am in current day (1/19). I would like to get Highest High on 1/18, 1/16, 1/14

          What I tried to get Highest in past 3 days for 1/18:
          MAX(Highs[1],3)[0]
          But apparently it is not working. Highs don't work that way.

          What other function I can use?

          Thanks.
          That is because you are using the wrong syntax. You want to query MAX(High, 3) from barsAgo bars ago. So you index your method to barsAgo.
          Code:
          MAX(High, 3)[barsAgo];
          Given the dates that you have specified, that means for the 18th, MAX(High, 3)[1];.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by SAILIKITY, 05-22-2019, 05:41 PM
          1 response
          2 views
          0 likes
          Last Post NinjaTrader_PaulH  
          Started by rmillar, 01-09-2019, 06:02 PM
          6 responses
          58 views
          1 like
          Last Post eDanny
          by eDanny
           
          Started by mlarocco, Today, 11:39 AM
          4 responses
          19 views
          0 likes
          Last Post mlarocco  
          Started by roblogic, Today, 11:19 AM
          2 responses
          14 views
          0 likes
          Last Post roblogic  
          Started by saeed, Today, 10:17 AM
          8 responses
          39 views
          0 likes
          Last Post NinjaTrader_Kate  
          Working...
          X