Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Reference Last "x" values of an indicator

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

    Reference Last "x" values of an indicator

    I want to trigger a trade if several conditions are met. The last of the conditions would check the past "x" amount of bars to determine the value of an indicator, and send the trade if the indicator had been above (or below) a certain value during that time frame.

    In other words, if I am using MACD, the trade would trigger if my other conditions were met AND the MACD value had closed at a value of less than -1 in the past 15 bars (if "x" is 15).

    The value threshhold and the # of bars to look back would be user inputs.

    I am sure that this has been addressed many times in the forum, but I can't seem to find the answer...I thought that the "look back" option would be the key, but it seems that would only reference the close of a specific bar, "x" bars ago. I want to check the value of all bars in the past "x" closes.

    Thanks!

    #2
    Originally posted by FennisDembo View Post
    I want to trigger a trade if several conditions are met. The last of the conditions would check the past "x" amount of bars to determine the value of an indicator, and send the trade if the indicator had been above (or below) a certain value during that time frame.

    In other words, if I am using MACD, the trade would trigger if my other conditions were met AND the MACD value had closed at a value of less than -1 in the past 15 bars (if "x" is 15).

    The value threshhold and the # of bars to look back would be user inputs.

    I am sure that this has been addressed many times in the forum, but I can't seem to find the answer...I thought that the "look back" option would be the key, but it seems that would only reference the close of a specific bar, "x" bars ago. I want to check the value of all bars in the past "x" closes.

    Thanks!
    You are looking for the CrossBelow() method.

    ref: http://www.ninjatrader.com/support/h...crossbelow.htm

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    585 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    340 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    552 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X