Thinkorswim Historical Implied Volatility 35

Combining the Historical and Implied Volatility into a Single Study

Thinkorswim Historical Implied Volatility

Thinkorswim Historical Implied Volatility

Free indicator included, linked below. Plot both the Historical and Implied Volatility together in the same subgraph of a stock chart. Clearly see where crossovers occur. Use this free indicator in a custom scan. Step-by-step instructions in the video show how to run three different kinds of scans from this one indicator. One of the three scans can be used as a pre-earnings scan. This can help you locate stocks where implied volatility is spiking ahead of an expected event, such as earnings, pending court settlements, or pending drug trials.

Use the link below to download this free indicator to your computer. For instructions on how to install it, look for the video titled “Thinkorswim Display Name of Saved Chart“. The instructions begin at the 4:28 mark.

Here is a link to download this free indicator:


Lean More:

Would you like to learn how to master the custom scan tools on Thinkorswim?

Click here: Thinkorswim Scans Beginner to Advanced

Learn how to build custom scans without writing any code: Thinkorswim Condition Wizard


*Thinkorswim is a chart analysis platform offered by TD

TD Ameritrade provides financial services including the trading of Stocks, Futures, Options and Forex.

Please be sure to share this page with your friends and colleagues. Leaving comments below is the best way to help make the content of this site even better.

Watch the video, Thinkorswim Historical Implied Volatility below:

Here is an updated version of the chart study which has already been configured to work as a scan. Seems that there are some additional steps required by the current version of Thinkorswim which were not required at the time this video was published.

# This source code is subject to the terms of the Mozilla Public License 2.0 at
# Author: Pete Hahn (Hahn-Tech, LLC)
# tutorial video:

declare lower;
declare hide_on_intraday;

input length = 20;
input basis = {default Annual, Monthly, Weekly, Daily};
input volatilitySpreadMultiplier = 2.0;

def ap = getAggregationPeriod();

Assert(ap >= AggregationPeriod.MIN, "Study can only be calculated for time-aggregated charts: " + ap);

def barsPerDay = (RegularTradingEnd(getYyyyMmDd()) - RegularTradingStart(getYyyyMmDd())) / ap;
def barsPerYear =
    if ap > AggregationPeriod.WEEK then 12
    else if ap == AggregationPeriod.WEEK then 52
    else if ap >= AggregationPeriod.DAY then 252 * AggregationPeriod.DAY / ap
    else 252 * barsPerDay;

def basisCoeff;
switch (basis) {
    case Annual:
        basisCoeff = 1;
    case Monthly:
        basisCoeff = 12;
    case Weekly:
        basisCoeff = 52;
    case Daily:
        basisCoeff = 252;

def clLog = log(close / close[1]);

def wklyPrctMove = round( ( highest(high, 5) - lowest(low, 5) ) / lowest(low,5), 3) * 100;

def mthlyPrctMove = round( ( highest(high, 21) - lowest(low,21) ) / lowest(low,21), 3) * 100;

def impVol = IMP_VOLATILITY();
def hv = stdev(clLog, length) * Sqrt(barsPerYear / basisCoeff * length / (length - 1));

# to use in scan mode, place '#' in front of these two plot statements
def impVolLine = impVol;
def histVolLine = hv ;

def doubleVolSpread = impVol > hv * volatilitySpreadMultiplier;
def signal = doubleVolSpread and highest(doubleVolSpread[1], 10) < 1;
def check = impVol != Double.NEGATIVE_INFINITY;
def check2 = impVol != Double.POSITIVE_INFINITY;

# use ONE of these three plot statements in scan mode. After commenting out
# the two plot statments above, select one of the three below and remove the
# '#' symbol from in front of the plot statment

# use this to find stocks where Implied Vol has reached two times Hist Vol
plot scan = if signal and check and check2 then 1 else Double.NaN;

# use this to find stocks where Implied Vol has crossed above Hist Vol
#plot scan = impVol > hv and impVol[1] < hv[1] and check and check2;

# use this to find stocks where Implied Vol has crossed below Hist Vol
#plot scan = impVol < hv and impVol[1] > hv[1] and check and check2;

About Pete Hahn

For those trying to contact me about our professional services you will find all those details here: Any questions not related to our professional services or premium indicators should be directed to the comment section of the applicable video or you may post a question in our Q&A Forum:

Questions? Comments? Post a review?

35 thoughts on “Thinkorswim Historical Implied Volatility

    • Pete Hahn Post author

      Not only do I not have anything by that description but I do not think anything like this would be possible for a chart study on Thinkorswim. You will have to view and aggregate those data points manually from the options chain on the Trade tab of Thinkorswim.

  • Chad

    Good morning. Is there a way to use the imp/hist vol on a 5 min chart? 2 seperate indicators take up too much room. Also should the basis be set to annuall ? A volume per minute would also be really good

    • Pete Hahn Post author

      1. To allow this study to display on intraday chart, remove or comment out the following line of code: declare hide_on_intraday;
      2. The “Basis” was copied from the built-in chart study named “HistoricalVolatility”. Refer to the documentation provided with that chart study.
      3. I have no plans to modify this any further by adding new plots or features.

    • Pete Hahn Post author

      I did not say to remove only the parenthesis. I said to to remove the entire AddLabel() statements. Don’t worry, I just updated this page to include a section of code which will work as a scan without any further modifications. Just refresh the page and you should see the code immediately below the video.

    • Pete Hahn Post author

      It seems that when this video was published, the AddLabel() statement did not create any errors when applying the script to a scan. Now that it does, simply remove them.

      • rmabramson

        I love this study! How would I use this in a watchlist? ie: Iv/hv is greater than 1?

      • Pete Hahn Post author

        Any code you use for a scan can be applied to a custom watchlist column without modifications. It will display 1’s where the selected scan signal is true and 0’s where the selected scan signal is false.
        In order to create a scan signal that fits your request, you can update the following scan signal:
        #plot scan = impVol > hv and impVol[1] < hv[1] and check and check2;

        and change it to this:
        plot scan = impVol > hv and check and check2;

        Then add a comment symbol, "#", in front of the first scan signal because only one plot statement can be active at one time.

    • Pete Hahn Post author

      Seems as though you missed some important details from the video. Go back and watch that section of the video again so you can see what adjustments are required to get it to work as a scan.