Chart a ratio of 2 index?

johnnyrocker

New member
VIP
Newbie question here.

I’d like to chart the VIX / VXv ratio.

on stockcharts.com I can use $VIX:$VXV Is something similar possible with a script?

efak57X.jpeg
 

BenTen

Administrative
Staff
VIP
Definitely possible but I don't think it's that simple on ThinkorSwim.

What you can do is use the code below (credit to @generic) and then select the 2 tickers of your choosing:

Code:
input tickerA = "SPY";
input tickerB = "VIX";

def ticker1 = close(symbol = tickerA, period = agg);
def ticker2 = close(symbol = tickerB, period = agg);

plot ratio = ticker1 / ticker2;
 
D

Deleted 7573

Guest
Hey @johnnyrocker - I had similar questions recently. Another way to go about this is as follows: Think or Swim allows you to define "composite symbols" where you can add or subtract two tickers together. See Learning Center - Composite Symbols (thinkorswim.com) So if you are in charts, you could graph (Ticker1) + (Ticker2) etc. Once you have that graph, you can go to studies, and select the study "PairRatio" This gives you the ratio of the two securities that are part of your composite security. Hope that helps.
 

Similar threads

Top