Scripting Guide for Relative Rotation Graphs®
One of the most powerful features of Optuma is our scripting language, which allows you to create your own tools, add custom watchlist columns, create your own scans and tools, and design strategies with our testing modules based on any technical criteria you can come up with. Click here for a video showing you where the scripting language can be used in the software.
On the plus side, this gives you a blank canvas where you can write formulas on any of the tools and technical indicators (including the more esoteric ones). On the negative side, it’s a blank canvas… where to start? This is especially true with Relative Rotation Graphs® – Julius de Kempenaer’s unique visualisation method of looking at the relative trend of multiple instruments against each other and a benchmark.
If you’re not familiar with RRGs, see Mathew’s video here which describes the theory and how it can help in your decision making. All clients with an Optuma services subscription have access to the RRG Lite version which allows you to create RRGs of your portfolio or index constituents against a benchmark, but Professional and Enterprise Services clients (or Trader Services clients can upgrade for $20 a month) have the ability to write scripts on Optuma’s unique derived indicators.
Optuma’s derived indicators
The derived indicators are based on different data points that can be used scanning and in quantitative testing of RRGs – many of which you will only find in Optuma. The following is a list of the derived indicators available in the JDKRS() function and how you can write a script to utililise them.
Ratio: Calculates the Ratio value of the data point (X axis): JDKRS().Ratio
Momentum: Calculates the Momentum value of the data point (Y axis): JDKRS().Momentum
Quadrant: Represents which quadrant the security is currently in:
- Leading: JDKRS().Quadrant == 0 (note that the double equals sign must be used to denote equality)
- Weakening: JDKRS().Quadrant == 1
- Lagging: JDKRS().Quadrant == 2
- Improving: JDKRS().Quadrant == 3
Angle: Represents the current position of the security on the RRG chart based on the points of the compass:
- 0-90 Degrees = Leading Quadrant, eg JDKRS().Angle > 0 and JDKRS().Angle < 45 will show the components in the ‘top half’ of the Leading quadrant
- 90-180 Degrees = Weakening Quadrant
- 180-270 Degrees = Lagging Quadrant
- 270-360 Degrees = Improving Quadrant
Angle ROC: The Angle Rate of Change measures the distance of the angle of the current data point of a security, to the previous data point. The greater the value, the larger the distance between the two data points. JDKRS().AngleROC IsUp
Distance: This number represents how far away the security is from the centre of the RRG chart (ie the benchmark). One of the observations is that higher alpha comes from those components that make bigger arcs around the benchmark. JDKRS().Distance > 2 will ignore those closest to the centre.
Heading: This is the angle that the arrow is pointing to, again based on the points of the compass, and is one of the most useful measures:
- 0 degrees = North (up)
- 45 degrees = Northeast
- 90 degrees = East (right)
- 180 degrees = South (down)
- 270 degrees = West (left)
- JDKRS().Heading > 30 and JDKRS().Heading < 60 will show those heading in a general northeast direction between 30 and 60 degrees, ie increasing ratio and momentum (see scan result image below).
- JDKRS().Heading CrossesAbove 270 will signal when the arrow changes from moving sideways (west) to up (north).
Velocity: This is the vector difference – or distance – between the last two data points on the line. For more than 3 days of increasing velocity use the DaysUp function: DU(JDKRS().Velocity) > 3
Here are the RRG values displayed as a Watchlist by ticking the Grid View property, with the corresponding RRG below:
Of course, you can create scans with multiple criteria based on any other technical indicator combined with RRGs, eg Heading between 30 and 60 degrees, with a distance > 2 on increasing velocity, but only for stocks where the 50 period moving average is also sloping up:
JDKRS().Heading > 30 and JDKRS().Heading < 60 and
JDKRS().Distance > 2 and JDKRS().Velocity IsUp and
MA(BARS=50, CALC=CLOSE) IsUp
Note: if using the scanning manager the results can be exported as an RRG, and saved as part of a workbook. When that RRG is next opened the scan is run again and the results automatically updated.
Setting the Benchmark
If you don’t specify the benchmark to be used the main index of the country of where the stock is listed will be used by default (ie XJO for Australia, SPX for the US). To change it, click on the JDKRS() function in the script editor window and change the Comparison Index to another index, or even the Comparison Style to Annual Rate of Return and specify the value.
Another benefit of being on the full version of Relative Rotation Graph module is the ability to create RRGs on foreign exchange. The next update to Optuma – contact us if you would like to be a beta tester – will allow you to also create scripting functions using the JDKFOREX() function. The same options are available as for the standard RRGs, ie Quadrant, Heading etc.
For more on the Optuma scripting language see our online video tutorial course.
Clients can also log in to the Scripting Forum to post questions and see lots of examples.
We understand that it can take time to get up to speed with learning to create your own scripts, and we’ll help where we can, but we also offer consulting services to help you design and test your strategies. Contact us for details.
Darren Hawkins, MSTA
Senior Software Specialist at Optuma
Darren is the senior Software Specialist at Optuma. He joined the company in 2009 after attending an introductory technical analysis course. Darren now instructs users all over the world, from experienced Wall Street traders and professional money managers to individual traders drawing their first trendlines.
Darren grew up in the UK and attended college in the USA where he earned a BA in Economics from St Mary's College of Maryland. He went on to spend a few years working at the Nasdaq Stock Market in Washington DC. Going on to live and work in Australia, the US and currently the UK, Darren has a broad understanding of the individual needs of traders, portfolio managers and investors utilising a wide range of methodologies.
In 2014 Darren passed the UK-based Society of Technical Analysts diploma course, and when not looking at charts he keeps a keen eye on England's cricket team - especially if they are playing against Australia. He lives in the Essex countryside in England, with wife Wendy and their labrador, Gabba.