Select Page

# Regime Change Indicator

Optuma Forums Optuma Scripting Regime Change Indicator

This topic contains 3 replies, has 2 voices, and was last updated by  Matthew 1 year ago.

Viewing 4 posts - 1 through 4 (of 4 total)
• Author
Posts
• #44563

Michael
• Topics: 3
• Replies: 5
• Posts: 8

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

#44571

Matthew
• Topics: 4
• Replies: 89
• Posts: 93

Hi Mike,

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 )

#44583

Michael
• Topics: 3
• Replies: 5
• Posts: 8

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 )

#44587

Matthew
• Topics: 4
• Replies: 89
• Posts: 93

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.

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

You must be logged in to reply to this topic.