Print Page | Close Window

How do you rank a series of values?

Printed From: BullCharts Forum
Category: BullCharts
Forum Name: BullScript
Forum Discription: Technical discussion related specifically to the BullScript programming language.
URL: http://www.bullcharts.com.au/forum/forum_posts.asp?TID=1009
Printed Date: 08 May 2024 at 2:15am
Software Version: Web Wiz Forums 9.69 - http://www.webwizforums.com


Topic: How do you rank a series of values?
Posted By: cudderbean
Subject: How do you rank a series of values?
Date Posted: 16 Dec 2016 at 9:56am
I am trying to code for the 3rd part of Connors RSI indicator..have managed the first two parts. Will post complete indicator here if anyone can help me with the 3rd.

The 3rd part of his indicator deals with today's rate of change over a one day close as a percenatge

roc(c,1,percent)

Connors then ranks a 100 days worth of these one day Rates of Change in order from the worst ROC fall in the last 100 days to the highest ROC gain in the last 100 days. He then literally gives each a numerical rank value...the lowest one day down ROC fall eg on CBA in the last 100 days is -2.57% (that becomes zero in an ordinal ranking scale)  the highest up ROC 3.086% (that becomes 100 in an ordinal ranking scale..over 100 days). The indicator is trying to evaluate just how serious this ROC is in the 100 day scale of things. Today's (15 Dec 16) CBA one day ROC is -.6652%. I want to know where that ranks in the scale of 100 days of ROC values in between -2.57% and 3.086%

I can sort of fudge it on BC using the MEDIAN function multiple times, but is there a better way where you can literally rank any series of values from zero (or lowest) to 100?

Ambiboker have the code PercentRank(ROC1, 100) . Does BC have an equivalent?
https://www.mta.org/wp-content/uploads/2015/11/1212-connors.pdf

Thank you for your help.





Replies:
Posted By: rcameron
Date Posted: 20 Dec 2016 at 10:30am
Sorry, don't think that is currently possible in Bullscript. Perhaps a suggestion to Brendon to include it as a standard indicator. I requested this some time ago, but  multiple requests will help. Rod


Posted By: cudderbean
Date Posted: 20 Dec 2016 at 7:43pm
Thank you, rcameron. I will put a request in as you suggested.

I notice Excel have the rank function too {  =RANK(number,ref,[order])  } so I can easily manage the calculation for all 3 parts of the Connors RSI there. But it is always good to try these things out on BC first and perhaps also backtest the reliability in Tradesim.

Thanks again, and all the best for Christmas.



-------------



Print Page | Close Window

Bulletin Board Software by Web Wiz Forums® version 9.69 - http://www.webwizforums.com
Copyright ©2001-2010 Web Wiz - http://www.webwiz.co.uk