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 cmoran13, 04-16-2026, 01:02 PM
    0 responses
    36 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    23 views
    0 likes
    Last Post PaulMohn  
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    162 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    96 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    152 views
    2 likes
    Last Post CaptainJack  
    Working...
    X