Analysing ranges of data
Forums › ProRealTime English forum › ProScreener support › Analysing ranges of data
- This topic has 5 replies, 2 voices, and was last updated 8 months ago by OllieB.
-
-
04/08/2024 at 11:36 AM #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.
04/08/2024 at 12:24 PM #231218Hi,
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:
123mydata=highest[245](high)myresult=mydata[6]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:
1return myresult as "highest between 6 days ago and 250 days ago"1 user thanked author for this post.
04/08/2024 at 12:29 PM #23121904/08/2024 at 2:08 PM #231234Hi 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.
04/08/2024 at 5:26 PM #231256For 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”:
1myresult= highestbars[20](high)In case you want the corresponding barindex number instead of how many bars ago, you can get it with:
1mybar= barindex-myresult1 user thanked author for this post.
04/08/2024 at 5:34 PM #231257 -
AuthorPosts
Find exclusive trading pro-tools on