Richard's answer is the correct answer to a slightly different question. However, I think what you’re asking for is the weighted average option implied volatility for a stock. This is most commonly referred to as the VIX for the S&P 500 Index (other securities have IV indices as well). The VIX uses a known methodology for imputing the implied volatility of a weighted strip of options in order to interpolate the one-month implied volatility of the index. A detailed [description of the VIX' calculation][1] is available on the CBOE website. Also, see the [previous post][2] for a detailed explanation on the evolution of the VIX.

I assume that brokers and data-providers use similar methods and heuristics to come up with something analogous to the VIX.

The first step is always to determine the implied volatilities a cross-section of option contracts. Richard provides one such method. I do not want to detract from it. 

One you have those implied volatilities, you can then construct an implied volatility index. On the simplest level, this an open-interest-weighted and maturity-weighted weighted average of the individual options’ implied volatilities.

I cannot speak to ThinkOrSwim’s exact approach, but I would be willing to bet it mirrors CBOE’s pre-2014 approach. Also, I do recall that TradeSation’s stock implied volatility algorithm is available in its native programming language—EasyLanguage. From what I recall, TradeStation calculates a stock’s implied volatility as a weighted average of out of the money puts and calls going forward on both the first and second expiration months. 

On a side note, just you can't actually trade an index, you cannot trade IV directly, but rather have to take a position in a tracking instrument or create a synthetic position. 

----------

Also, I am copying code from VBA which uses the Newton's algorithm to find the implied volatility of a call option given the underlying price, exercise price, time, interest, target (usually market) price of a call, and dividend yield.

1. $d_1$
<pre>Function dOne(UnderlyingPrice, ExercisePrice, Time, Interest, Volatility, Dividend)
dOne = (Log(UnderlyingPrice / ExercisePrice) + (Interest - Dividend + 0.5 * Volatility ^ 2) * Time) / (Volatility * (Sqr(Time)))
End Function</pre>

2. Value of call options

<pre>Function CallOption(UnderlyingPrice, ExercisePrice, Time, Interest, Volatility, Dividend)
CallOption = Exp(-Dividend * Time) * UnderlyingPrice * Application.NormSDist(dOne(UnderlyingPrice, ExercisePrice, Time, Interest, Volatility, Dividend)) - ExercisePrice * Exp(-Interest * Time) * Application.NormSDist(dOne(UnderlyingPrice, ExercisePrice, Time, Interest, Volatility, Dividend) - Volatility * Sqr(Time))
End Function </pre>

3. Implied call volatility
<pre>Function ImpliedCallVolatility(UnderlyingPrice, ExercisePrice, Time, Interest, Target, Dividend)
High = 5
Low = 0
Do While (High - Low) > 0.0001
If CallOption(UnderlyingPrice, ExercisePrice, Time, Interest, (High + Low) / 2, Dividend) > Target Then
High = (High + Low) / 2
Else: Low = (High + Low) / 2
End If
Loop
ImpliedCallVolatility = (High + Low) / 2
End Function
</pre>


  [1]: http://cfe.cboe.com/cfe-education/cboe-volatility-index-vx-futures/vix-primer/cboe-futures-exchange-nbsp-nbsp-education
  [2]: https://quant.stackexchange.com/questions/25157/how-was-the-old-vix-calculated