Regime Change Indicator


There is an indicator described at this this web site that appears to be useful for analyzing the trendiness of the price action.

I tried programming it and came up with this

Y = ACC( truerange, 10) / (HIGHESTHIGH(BARS=10) - LOWESTLOW(BARS=10));
STD(Day(PERIODAMOUNT=1), y, TYPE=Percentage)

I don't think this is correct. The problem is in the second line, I am trying to find the percentile rank of the current value in the formula relative to the past year. Is there a function that finds the percentile rank?

Thank you, Mike

Hi Mike,

Thank you for your post.

I’ve had a look at the link you listed, and the rules on that page to see if i can build a corresponding script. Please try the following and see how you go:

V1 = HIGH() - LOW() ; V2 = ACC(V1, RANGE=Look Back Period, BARS=10) ; V3 = HIGHESTHIGH(BARS=10) - LOWESTLOW(BARS=10) ; V4 = V2 / V3 ; V5 = MA(V4, BARS=60, CALC=Close) ; Z=(V5-MA(V5, BARS=252))/STD(V5, BARS=252); Exp(-1*(z*z)/2) / Sqrt(2* 3.141592 )

Thank you. Are the last two lines the standard code for a z-score?


Z=(V5-MA(V5, BARS=252))/STD(V5, BARS=252);
Exp(-1*(z*z)/2) / Sqrt(2* 3.141592 )

Hi Michael,

That’s correct. We don’t have a function which does the calculation automatically so that was the manual breakdown of the calc.