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 CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    237 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    152 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    163 views
    1 like
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    246 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    198 views
    0 likes
    Last Post CarlTrading  
    Working...
    X