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

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 BarzTrading, Today, 07:25 AM
    2 responses
    22 views
    1 like
    Last Post BarzTrading  
    Started by devatechnologies, 04-14-2024, 02:58 PM
    3 responses
    20 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by tkaboris, Today, 08:01 AM
    0 responses
    4 views
    0 likes
    Last Post tkaboris  
    Started by EB Worx, 04-04-2023, 02:34 AM
    7 responses
    163 views
    0 likes
    Last Post VFI26
    by VFI26
     
    Started by Mizzouman1, Today, 07:35 AM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X