Larry Williams' "Willspread" Indicator for Thinkorswim

Pensar

Active member
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.

willspread.png


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);
willspread.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
willspread.AssignValueColor(if willspread > 0 and willspread > willspread[1] then Color.GREEN
                            else if willspread > 0 then Color.DARK_GREEN
                            else if willspread < 0 and willspread < willspread[1] then Color.RED
                            else Color.DARK_RED);

# end code
 

Jonas99

Member
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

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);
willspread.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
willspread.AssignValueColor(if willspread > 0 and willspread > willspread[1] then Color.GREEN
                            else if willspread > 0 then Color.DARK_GREEN
                            else if willspread < 0 and willspread < willspread[1] then Color.RED
                            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:

mashume

Well-known member
VIP
6OeKnz.jpg


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
 

elliotv

New member
VIP
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.
 

Pensar

Active member
VIP
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

Member
VIP
@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 !
 

ewolf

New member
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

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.

willspread.png


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);
willspread.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
willspread.AssignValueColor(if willspread > 0 and willspread > willspread[1] then Color.GREEN
                            else if willspread > 0 then Color.DARK_GREEN
                            else if willspread < 0 and willspread < willspread[1] then Color.RED
                            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.
 

Similar threads

Top