Tagged: RRG scripts
May 30, 2018 at 1:52 am #46971
For Optuma clients with the full RRG module who are interested in scanning or testing RRG scenarios see this blog post with examples using the derived indicators (eg Heading, Distance, Velocity, etc):August 3, 2018 at 6:24 am #47791
The distance between each data point on an RRG tail is measured by the velocity – JDKRS().Velocity – so to calculate the tail length you can add them together using the Accumulation function ACC() over the required time period. The longer the tail the more momentum in the relative trend.
For a 5 period tail you would use the following using the default benchmark index (ie XJO for ASX, SPX for US stocks):1234V1=JDKRS().Velocity;ACC(V1, RANGE=Look Back Period, BARS=5)
In this example, the Dow 30 have been ranked by tail length, with the longest 3 (INTC, CVX & JPM) plotted on the RRG with the shortest 3 (HD, WMT & IBM with lowest momentum).
March 5, 2019 at 1:19 am #51427
- This reply was modified 3 years ago by Darren.
To colour code the quadrants in a watchlist column the following (using the default benchmark) will convert the column in to a value, as follows:
0 = Leading
1 = Weakening
2 = Lagging
3 = Improving
Then label and colour the column using the following Custom Labels:July 23, 2019 at 10:09 pm #54121
Attached is a workbook for US industry ETF watchlist with RRG quadrant info in a column and 4 coloured Show View scripts dragged over each other.August 21, 2019 at 10:02 pm #54379
A sure sign of strength is when a stock moves from Weakening back to Leading without rotating to Lagging – basically it rotates on the right side of the RRG chart without the RS Ratio crossing below 100.
We can scan (and test) for when that happens using the following formula:123456//When RS Ratio > 100 ie on right side of RRG for at least 2 datapointsJDKRS().Ratio > 100 and JDKRS().Ratio > 100 and//and RS Momentum crosses above 100 ie moves from Weakening to LeadingJDKRS().Momentum CrossesAbove 100
Scan results:May 26, 2021 at 12:09 am #64301
Using the Heading value we can define ranges to show the general RRG direction in a watchlist by splitting the 360° of the circle into eight equal 45° segments. For example, we can define those heading northeast as being between 22.5° and 67.5° i.e. both have increasing relative strength and momentum (good), whereas those moving in a southwest direction (between 202.5° and 247.5°) have the opposite (bad).
We can also break up the remainder of the ranges as follows:
North – between 337.5° and 22.5°
East – between 67.5° and 112.5°
Southeast – between 112.5° and 157.5°
South – between 157.5° and 202.5°
West – between 247.5° and 292.5°
Northwest – between 292.5° and 337.5°
These can be scripted as follows, and when the condition is true the IF() statement assigns a value, such as Southeast = 4, with the other IF statements being false (giving a result of zero):123456789101112131415//Get Heading ValuesV1 = JDKRS().Heading;//Define Ranges and assign valuesN1 = IF(V1 > 337.5 or V1 < 22.5,1,0);NE = IF(V1> 22.5 and V1 < 67.5,2,0);E1 = IF(V1 > 67.5 and V1 < 112.5,3,0);SE = IF(V1 > 112.5 and V1 < 157.5,4,0);S1 = If(V1 > 157.5 and V1 < 202.5,5,0);SW = IF(V1 > 202.5 and V1 < 247.5,6,0);W1 = IF(V1 > 247.5 and V1 < 292.5,7,0);NW = IF(V1 > 292.5 and V1 < 337.5,8,0);//Sum valuesN1+NE+E1+SE+S1+SW+W1+NW
When added as a watchlist column the values can then be used in the conditional formatting for labels and/or colours:June 7, 2021 at 1:24 am #64689Jan
- Topics: 2
- Replies: 3
- Posts: 5
Thanks for this code.
However, when I wanted to use it, it didn’t work for me. I live in Europe, and there they use a comma instead of a period for the decimal.
Sixty-seven and a half is written in Europe as 67,5 However, the code mentions 67.5 To get the code to work I had to modify it and use extra(). This can cause problems with more complex encodings. Is this due to my Optuma settings, and if so how do I adjust this? I’m attaching the code I modified so you can see what I’ve changed to make it work here in Europe. Kind regards, Jan.1234567891011121314//Get Heading Values V1 = JDKRS(INDEX=SXXP:WI).Heading;//Define Ranges and assign valuesN1 = IF( (V1 > 337,5) or (V1 < 22,5) ,1,0);NE = IF( (V1> 22,5) and (V1 < 67,5) ,2,0);E1 = IF( (V1 > 67,5) and (V1 < 112,5) ,3,0);SE = IF( (V1 > 112,5) and (V1 < 157,5) ,4,0);S1 = If( (V1 > 157,5) and (V1 < 202,5) ,5,0);SW = IF( (V1 > 202,5) and (V1 < 247,5) ,6,0);W1 = IF( (V1 > 247,5) and (V1 < 292,5),7,0);NW = IF( (V1 > 292,5) and (V1 < 337,5),8,0);//Sum valuesN1+NE+E1+SE+S1+SW+W1+NW
June 7, 2021 at 10:07 pm #64735
- This reply was modified 6 months ago by Jan Schotsman.
Thanks Jan. There’s no settings in Optuma as it uses your Windows regional format settings. However, I’m using the next release of Optuma and after setting the regional settings to display 67,5 instead of 67.5 the RRG script provided works without adding the additional () or changing the ‘.’ to ‘,’
The beta version should be available for client testing in a couple of weeks when you will be able to try it for yourself (we’ll let you know when it’s available).
- You must be logged in to reply to this topic.