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."...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.)
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