Stock Percentile Measure

Forums ProRealTime English forum ProBuilder support Stock Percentile Measure

Viewing 7 posts - 1 through 7 (of 7 total)
  • #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

    #14756

    You can easily count if a condition is true with a summation of this condition, like this:

    Didn’t test it, should work as is. You’ll get a ratio here.

     

    #14780

    Nicolas,

    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

    #14783

    Ok, try this instead:

     

    #14947

    Hello 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

    #14948

    The last code I gave you should do what you need. Because the code store the current close at line 1 and then make a summation of how much condition tested return true.

    #14950

    OK, got it, many thanks Nicolas

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

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