Stock Percentile Measure
Forums › ProRealTime English forum › ProBuilder support › Stock Percentile Measure
- This topic has 6 replies, 2 voices, and was last updated 8 years ago by deletedaccount14122020.
-
-
10/11/2016 at 5:59 PM #14727
Hello Nicolas,
I’m currently working on a couple of new indicators which I will send to ProRealCode when completed. I’m struggling with a part of my code and was wondering if you could advise.
What I want to do is this:
I want to know how many times the current CLOSE is higher than the previous 180 days CLOSES expressed as a percentage.
Example using the last four days only : Last previous days CLOSE 10, 10, 15, 20
Todays CLOSE is 18. Therefore this beats the previous four closes 3 out of 4 = 75%
Hope this makes sense and thanks in advance
10/12/2016 at 10:55 AM #14756You can easily count if a condition is true with a summation of this condition, like this:
1234567currentclose=Closecount = SUMMATION[180](currentclose>close)ratio = count/180return ratioDidn’t test it, should work as is. You’ll get a ratio here.
10/12/2016 at 4:01 PM #14780Nicolas,
Thanks for your reply however I cannot get this to work as per your code. Example using just 5 periods back in time. Today’s close is 39.11, last 5 days are 38.33, 38.90, 38.98, 38.08, 38.54. Todays price is therefore beating the previous 5 days a 100% of the time. The code produces 60%.
I also had to change the currentclose to close[1] as just close produced zero values. I’m not running real time just 1 day delayed
currentclose= Close [1]
count = SUMMATION[5](currentclose>close)
ratio = count/5
return ratio
Many thanks
10/12/2016 at 4:07 PM #1478310/15/2016 at 4:00 PM #14947Hello Nicolas, Thanks for the follow up. I think this code is looking at the current close and the previous close every day for each SUMMATION value and presenting a value. What I’m trying to achieve is some code where the current close is always the latest value and it checks this value against the close on all the previous values (as defined in the SUMMATION line) and produces a count. Do you think I’m correct here or have I got my thinking wrong?
Many thanks
10/15/2016 at 4:13 PM #1494810/15/2016 at 4:37 PM #14950OK, got it, many thanks Nicolas
-
AuthorPosts
Find exclusive trading pro-tools on