Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Test for Rising value over x bars ago

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

    Test for Rising value over x bars ago

    Can someone help me with the code on how to test if a value has risen on any of 'x' bars ago?

    the internal Rising() feature only works on 1 bar ago. I need the same test, but with further back like 50 bars...

    I know it's something like this, but not quite...

    while x < 50 // 50 bars ago
    do
    {
    if Value[x] > Value[x-1] rising = true;
    x++;
    }

    TIA
    Mike

    #2
    try using the slope function if it is positive it's rising and negative if it is falling.

    Comment


      #3
      Should be "x + 1" not "x - 1"
      RayNinjaTrader Customer Service

      Comment


        #4
        Thanks, I will try the slope method.

        I need it to be usable in a long laundry list of if statements, so the while loop doesn't work as nested inside an if statement, would have to re-do my strategy logic.

        I don't know much about slope, but will go learn about it.

        Comment


          #5
          Originally posted by NinjaTrader_Ray View Post
          Should be "x + 1" not "x - 1"
          Oops

          thx
          Mike

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          576 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          334 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          553 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          551 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X