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

Highest and Lowest values for a specific indicator over the previous XX Bars

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

    Highest and Lowest values for a specific indicator over the previous XX Bars

    I have a basic question about the highest and lowest values for a specific indicator in the previous XX bars. I see examples that refer to price, but I haven't come across one that uses an indicator with its appropriate settings.

    I would like to subtract the highest RSI value from the lowest RSI value from the preceding 1-7 bars. I do not want to use the current bar in this calculation.

    The indicator:

    RSI(BarsArray[1], 14, 1)


    I have seen MIN, MAX, HighestBar(), and LowestBar(). I am not sure which to use in this calculation. What is the correct way to achieve this result?

    Thanks in advance.
    Last edited by ArmKnuckle; 12-17-2019, 03:33 AM.

    #2
    Hello ArmKnuckle,

    Thanks for your post.

    With reference to the Syntax of the Min (and MAX) methods you will note it shows (ISeries<double> input, int period). this means you can basically use any input series. Typically this would be price such as Close(the default) High, low, etc.

    In the case of the RSI it appears you have an added data series, so to obtain the MIN of the RSI of the added data series: MIN(RSI(Closes[1], 14, 1).Default, 7)[1]. Likewise MAX((RSI(Closes[1], 14, 1).Default, 7)[1]. By using the barsAgo index of [1] this would not consider the current bar value of the RSI and would look at the previous 7 bars.

    References:


    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by DayTradingDEMON, Today, 09:28 AM
    4 responses
    21 views
    0 likes
    Last Post DayTradingDEMON  
    Started by geddyisodin, Yesterday, 05:20 AM
    9 responses
    50 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by George21, Today, 10:07 AM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Started by Stanfillirenfro, Today, 07:23 AM
    9 responses
    24 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by navyguy06, Today, 09:28 AM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X