Reply To: An indicator that references two specific securities

Optuma Forums Optuma Scripting An indicator that references two specific securities Reply To: An indicator that references two specific securities

  • Topics: 5
  • Replies: 366
  • Posts: 371


There are actually two scripts that would be needed to do this.  One to set the value and one to control the colour.

As we are only working with a single value (the difference between the two ROCs) a shaded ribbon does not really work well.  A shaded zone usually needs two reference points, so i have used a Histogram in my example.  If you were planning to have the individual ROC values as plots on the script as well as the change, a ribbon may work, what i’ve provided below should give you the foundation you need to build the display style you are after.

The script to find the ROC variation between the two codes would be:

Applied using a Show View, the Plot Style needs to be set to Histogram and the Colour scheme set to Custom.  This will allow us to setup the second script to control the colour so that the bars are green whenever the ROC for CPER is higher than that of GLD.

Set the colour for this script to be green and the default colour to be red, and it will display the expected result.


I’ve attached a workbook sample you can reference.

Regarding the time frame and ROC periods, these can be changed in the script.  Time frames via the Data1 and Data2 variables, and the ROC period via the V1 and V2 variables.


Pin It on Pinterest