Analysing ranges of data

Forums ProRealTime English forum ProScreener support Analysing ranges of data

Viewing 6 posts - 1 through 6 (of 6 total)
  • #231216

    Hi,

    Can anyone please tell me the best way to analyse a dataset that doesn’t include the most recent, say, 5 days?

    For example, if I want to find the highest value in the previous 5 to 250 days (ie the last year, but excluding the most recent week), how do I do it?  highest(250) will include the most recent 5 days.

    The built in functions always seem to work on the premise of current candle to a value X candles away.  So highest(10) will look at the most recent 10 candles, but if I wanted to analyse candles 11-20, how do I do it?  Is there a way to introduce an offset, something like highest (5,10), which would start the analysis 5 candles back and analyse the 10 candles before the offset?

    Is there a range capability built into the functions, or will I have to build an array and analyse that?  Or is there a clever way (beyond me!) that can count candles?

    Any help as always is very much appreciated.

    Thanks.

    #231218

    Hi,

    Assuming a real time PRT version (not the end of day version), and looking at 250 previous days (not including current day), we want the highest from 6th previous to 250th previous, then that’s a 245 day span, you create a variable “mydata” searching for highest within 245, and you look at the value it had 6 days ago, therefore without the need a new function:

     

    to be added in your screener as we are in proscreener forum,

    or if you want to see it in an indicator too/instead, adding a final return line:

     

     

    1 user thanked author for this post.
    #231219

    Hi JC,

    Thank you for replying.

    Thats pretty clever, thanks.  I’ll give it a go!

    #231234

    Hi JC,

    That’s great, it works.  And I understand it, so I have learnt something as well, thanks.

    Maybe you can help with a similar but slightly different problem.  If I have a range of data, say 20 values, how do I find which of those has the highest high?  So instead of returning the highest value, it returns which position in the range the highest value is at?

    something like:

    ReturnVal = position(highest[20])

    Thanks.

    #231256

    For this, you want to use the command highestbars, it saves you writing a for-next loop scanning past candles to check at what barindex was the highest. The result is “how many bars ago”:

    In case you want the corresponding barindex number instead of how many bars ago, you can get it with:

     

    1 user thanked author for this post.
    #231257

    Thats awesome, thanks JC.  You are a master!

Viewing 6 posts - 1 through 6 (of 6 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login