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 rexsole, Today, 08:39 AM
    0 responses
    1 view
    0 likes
    Last Post rexsole
    by rexsole
     
    Started by trilliantrader, Yesterday, 03:01 PM
    3 responses
    30 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by cmtjoancolmenero, Yesterday, 03:58 PM
    4 responses
    26 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by Brevo, Today, 01:45 AM
    1 response
    14 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by rjbtrade1, 11-30-2023, 04:38 PM
    2 responses
    74 views
    0 likes
    Last Post DavidHP
    by DavidHP
     
    Working...
    X