Reply To: Percent Rank Within Range Over Indicator History

Optuma Forums Optuma Scripting Percent Rank Within Range Over Indicator History Reply To: Percent Rank Within Range Over Indicator History

#55251
MathewMathew
  • Topics: 29
  • Replies: 1,474
  • Posts: 1,503

Hi Mason,

The easiest way to do this is with a Stochastic function. Essentially what the Stochastic does is look back through a range and take note of the highest and lowest prices. Then it compares the current price and provides us with a percentage value. This is a great way to normalize values for comparison.

If I was doing this on a chart, I would add a Fast Stochastic tool, set the %K to 1000 bars and hide %D (turn off “visible” in “D Plot Style”). Remember that you can save this to your tool bar from the actions menu (running man on a right click). Then you can apply this visually to price or any other indicator.

If you wanted to limit the calculation to the last year, just set %K to 252 (on a daily chart).

To achieve the same thing in scripting just use this script

STOCH(BAR1=1000)

If I wanted it on another indicator, I would first put that result in a variable

V1 = ADX().ADX;
STOCH(V1, BAR1=1000)

Here you can see where I have this in a watchlist and on a chart.

Hope that helps

Mathew

MSFT

Pin It on Pinterest

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close