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

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 trilliantrader, 04-18-2024, 08:16 AM
          5 responses
          22 views
          0 likes
          Last Post trilliantrader  
          Started by Davidtowleii, Today, 12:15 AM
          0 responses
          3 views
          0 likes
          Last Post Davidtowleii  
          Started by guillembm, Yesterday, 11:25 AM
          2 responses
          9 views
          0 likes
          Last Post guillembm  
          Started by junkone, 04-21-2024, 07:17 AM
          9 responses
          70 views
          0 likes
          Last Post jeronymite  
          Started by mgco4you, Yesterday, 09:46 PM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Working...
          X