# Larry Williams' "Willspread" Indicator for Thinkorswim

#### Pensar

##### Expert
VIP
I've recently read Larry Williams' book Long Term Secrets to Short Term Trading. In it, he describes his "Willspread Index". Quoting from his book, the indicator is
"...a measure of the flow of price between the primary market we are trading and a secondary market that influences the primary. As you know, Bonds influence stocks, and Gold influences Bonds; Willspread allows us to spot the inner workings of these market relationships." (Larry Williams, Long Term Secrets to Short Term Trading, p.170, 2nd ed.)
I've chosen to use the 10-year US Treasury Bond Notes for the default secondary comparison indicator. I would recommend reading Larry Williams' book for further explanation and a better understanding of how he uses this indicator.

Code:
``````# Larry William's Willspread
# Pensar
# 03.19.2021

declare lower;

input secondary = "/ZN";
input fast_avg = 5;
input slow_avg = 20;
def val = close / close(symbol = secondary) * 100;
plot willspread = Average(val, fast_avg) - Average(val, slow_avg);
else if willspread > 0 then Color.DARK_GREEN
else Color.DARK_RED);

# end code``````

I've recently read Larry Williams' book Long Term Secrets to Short Term Trading. In it, he describes his "Willspread Index". Quoting from his book, the indicator is

I've chosen to use the 10-year US Treasury Bond Notes for the default secondary comparison indicator. I would recommend reading Larry Williams' book for further explanation and a better understanding of how he uses this indicator.

Code:
``````# Larry William's Willspread
# Pensar
# 03.19.2021

declare lower;

input secondary = "/ZN";
input fast_avg = 5;
input slow_avg = 20;
def val = close / close(symbol = secondary) * 100;
plot willspread = Average(val, fast_avg) - Average(val, slow_avg);
else if willspread > 0 then Color.DARK_GREEN
else Color.DARK_RED);

# end code``````
thank you for sharing your work. It looks quite similar to TTM Squeeze? It would be great if the squeeze dots can be programmed onto the same study.

Last edited:

I tried combining it with the /mes futures and /vx but there are some gaps and don't know why

I tried combining it with the /mes futures and /vx but there are some gaps and don't know why
There are points where there is /mes data (trades) but no /vx trades. This is normal. If you plot only RTH and a time aggregation (not ticks) it should not have gaps... probably

-mashume

thank you for sharing your work. It looks quite similar to TTM Squeeze? It would be great if the squeeze dots can be programmed onto the same study.
Literally the only similarity is that it is a histogram. Anyways, really cool study.

Literally the only similarity is that it is a histogram. Anyways, really cool study.
@Jonas99 @elliotv is correct. The TTM_Squeeze histogram uses momentum to show the possible direction of the current symbol being traded. The Willspread is more of a market strength indicator, it displays which of two markets is stronger, and can help determine if a symbol is strong or weak compared to the overall market, depending on the secondary input. Hence the comparison to bonds when trading stocks or indexes, or to gold if trading bonds. Larry Williams explains its use much better than I can. If you really want squeeze dots though, just add this code below the Willspread code.

Code:
``````input Length = 20;

def hb = 1.0;
def mb = 1.5;
def lb = 2.0;
def avg = average(close, length);
def k1 = avg + (hb * Average(TrueRange(high, close, low), length));
def k2 = avg + (mb * Average(TrueRange(high, close, low), length));
def k3 = avg + (lb * Average(TrueRange(high, close, low), length));
def BB_offset = 2.0;
def sDev = StDev(close, length);
def mid = Average(close, length);
def bb = mid + BB_offset * sDev;
def s0 = bb > k3;
def s1 = bb < k1;
def s2 = bb < k2;
def s3 = bb < k3;

plot squeeze = if !IsNaN(close) then 0 else Double.NaN;
squeeze.SetLineWeight(2);
squeeze.SetStyle(Curve.POINTS);
squeeze.AssignValueColor(if s1 then Color.ORANGE
else if s2 then Color.RED
else if s3 then Color.MAGENTA
else Color.GREEN);``````

@Jonas99 @elliotv is correct. The TTM_Squeeze histogram uses momentum to show the possible direction of the current symbol being traded. The Willspread is more of a market strength indicator, it displays which of two markets is stronger, and can help determine if a symbol is strong or weak compared to the overall market, depending on the secondary input. Hence the comparison to bonds when trading stocks or indexes, or to gold if trading bonds. Larry Williams explains its use much better than I can. If you really want squeeze dots though, just add this code below the Willspread code.
Thanks so much @Pensar !

I've recently read Larry Williams' book Long Term Secrets to Short Term Trading. In it, he describes his "Willspread Index". Quoting from his book, the indicator is

I've chosen to use the 10-year US Treasury Bond Notes for the default secondary comparison indicator. I would recommend reading Larry Williams' book for further explanation and a better understanding of how he uses this indicator.

Code:
``````# Larry William's Willspread
# Pensar
# 03.19.2021

declare lower;

input secondary = "/ZN";
input fast_avg = 5;
input slow_avg = 20;
def val = close / close(symbol = secondary) * 100;
plot willspread = Average(val, fast_avg) - Average(val, slow_avg);
else if willspread > 0 then Color.DARK_GREEN
else Color.DARK_RED);

# end code``````
The idea is really interesting but for stocks, it is better to use the sector index as a secondary comparison indicator. I have checked the tech index ("XLK") with tech stocks and the picture looks more accurate, IMO.

The spread (A/B *100) takes two underlyings, get the exponential average creating exponential period (5) and subtract from another exponential period (20). The example he gives is that bonds move stocks, so we take the S&P and bonds. Get a will spread of SPY & TLT.

The technical indicator Will-Spread was developed by Larry Williams and described in his book Long-Term Secrets to Short-Term Trading. Will-Spread is one of the strongest financial indicators, which measures the flow of price between the primary market and a secondary market. The purpose of this comparison is to highlight signals for opening/closing positions of a financial asset through market signals that have influence on this particular asset. Once the Will Spread turns positive, look for the next bar to be above bar when Will spread turned positive to get long. http://tos.mx/Eqjf7S

Indicator Use

Trading use The main method of using Will-Spread is watching the way it crossing the zero line. If the indicator crosses the zero line upward, rising trend is likely to continue. When the indicator falls below the zero line, there is an obvious downtrend. The author offered to use the indicator in trading from the standpoint of a filter: when Will-Spread crosses the zero line, a trader should wait for the formation of the bar that follows after the signal. In case the new bar generates a high/low above/below the previous one, a trader should open position. It is not recommended to open position if the bar does not form a new high/low.

Code:
``````#Spread = (Close (market1, n)/Close (market2, n))*100

declare lower;

input price = FundamentalType.CLOSE;
input relationWithSecurity = "TLT";

#daily time frame use 5 / 20 time period
#intraday 30 minute chart will useuse 3 / 15 time periods
input length1 = 5;
input length2 = 20;
input zero_line = 0;

#input averageType = AverageType.exponential;

def price1 = Fundamental(price);
def price2 = Fundamental(price, relationWithSecurity);

def spread = (price1 / price2)*100;

plot spreadplot = num1 - num2;
Plot zeroline = zero_line;

zeroline.setdefaultcolor(getcolor(5));

I made a slight adjustment to Pensar's original code based on the book, as Larry specified that the indicator is based on the exponential averages, not simple averages as originally written here.

It's also worth noting later in the chapter as Larry explains refinements he's made over time while using it that he now prefers 3/20 over the original 5/20:

Code:
``````# Larry William's Willspread
# Pensar
# 03.19.2021
# Updated 05.17.2023 by emaguireiv

declare lower;

input secondary = "/ZN";
input fast_avg = 3;
input slow_avg = 20;
def val = close / close(symbol = secondary) * 100;
plot willspread = ExpAverage(val, fast_avg) - ExpAverage(val, slow_avg);
else if willspread > 0 then Color.DARK_GREEN
else Color.DARK_RED);

# end code``````

By chance has someone created a scan in TOS when the WillSpread crosses above or below the zero line?

87k+ Posts
704 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?