• 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

Using lists

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

    Using lists

    Hi!

    I was wondering about using lists. Is there any example where I can see its use?

    I'm trying to solve this problem: (I don't know the proper syntax, but I'm trying to make it clear)

    1. I have identified a bar (i bars ago) and I want to do a search around that bar to get its highest high, for example in the range (i +r ----> i-r).
    2. I can create some kind of list and add the elements:
    for (int x= i-r,x < i+r+1;x++)
    add (high[x], highlist);
    3. Then sort with the proper command to get the maximum.:
    GetHighOfList(highlist)

    Perhaps there is a native function to do this but I've searched and didn't see anything.

    Thanks in advance,

    Sergio

    #2
    Hello Sergio,
    Thanks for writing in and I am happy to assist you.

    You can use the HighestBar fucntion to find the highest bar. Please refer here to know more
    http://www.ninjatrader.com/support/h...highestbar.htm


    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      But that only work if I want to search from last bar.

      Let's explain a bit more:

      With:

      HighestBar(High, 6) I will check bars [0],[1],...[6]

      but what I want is searching around bar [16]

      and check [19],[18]...[16]...[14],[13] only

      not [19],[18]...[0]

      Hope this helps to know what I want.

      Comment


        #4
        Hello sercava,
        Thanks for the clarification.

        Please use the MAX function to do it. A sample code will be like
        Code:
        if (CurrentBar > 19)
        double highestHigh = MAX(High, 6)[13];
        http://www.ninjatrader.com/support/h...aximum_max.htm

        Please let me know if I can assist you any further.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          That's what I need, thanks. Will code it.

          Have fun!

          Sergio

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by dkbyond, Today, 04:11 PM
          0 responses
          1 view
          0 likes
          Last Post dkbyond
          by dkbyond
           
          Started by markus3500, Today, 03:29 PM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_EricB  
          Started by bohenriksen, Today, 04:00 AM
          1 response
          20 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by brett0, Today, 12:33 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_Melissa  
          Started by lordvader34, Today, 11:12 AM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_PatrickG  
          Working...
          X