Hawkeye Volume Indicator for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
A volume indicator developed by Nigel Hawks to show bullish, bearish, and neutral sentiment. There aren't many documentations about it, but I found a YouTube video and a post from Hawkeye Traders that might be useful.
  • Green volume bars = bullish
  • Red volume bars = bearish
  • Gray volume bars = neutral
Credit also goes to LazyBear from TradingView.

4E0eUpm.png


thinkScript Code

Code:
# HawkEye Volume Indicator
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/gci6llVF-Indicator-HawkEye-Volume-Indicator/

declare lower;

input length = 200;
input divisor = 3.6;
def range = high - low;
def rangeAvg = simpleMovingAvg(range, length);
def volumeA = simpleMovingAvg(volume, length);

def high1 = high[1];
def low1 = low[1];
def mid1 = hl2[1];

def u1 = mid1 + (high1 - low1) / divisor;
def d1 = mid1 - (high1 - low1) / divisor;

def r_enabled1 = (range > rangeAvg) and(close<d1) and volume > volumeA;
def r_enabled2 = close < mid1;
def r_enabled = r_enabled1 or r_enabled2;

def g_enabled1 = close > mid1;
def g_enabled2 = (range > rangeAvg) and(close > u1) and(volume > volumeA);
def g_enabled3 = (high > high1) and(range<rangeAvg/1.5) and(volume<volumeA);
def g_enabled4 = (low < low1) and(range<rangeAvg/1.5) and(volume > volumeA);
def g_enabled = g_enabled1 or g_enabled2 or g_enabled3 or g_enabled4;

def gr_enabled1 = (range > rangeAvg) and(close > d1) and(close<u1) and(volume > volumeA) and(volume<volumeA*1.5) and(volume > volume[1]);
def gr_enabled2 = (range < rangeAvg / 1.5) and(volume<volumeA/1.5);
def gr_enabled3 = (close > d1) and(close<u1);
def gr_enabled = gr_enabled1 or gr_enabled2 or gr_enabled3;

plot histogram = volume;
histogram.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
histogram.assignValueColor(if gr_enabled then color.gray else if g_enabled then color.green else if r_enabled then color.red else color.white);

 

Al_S

New member
Ben, so sorry.
I've imported the script, but nothing shows up on the chart (yes, it's in lower, and I can eve edit the parameters, but, still)

Any thoughts?

BTW, thanks so very much for scripting Hawkeye VSA!
7xhFyFw.jpg
 
Last edited by a moderator:

MerryDay

Administrative
Staff member
Staff
VIP
Lifetime
@Al_S
The Future Indices and the Forex data channels do not include volume.
Volume for an index depends on the construction of the index -- the S&P is capitalization-weighted, so summed-constituent volume is not meaningful.
Therefore, Volume Indicators do not work with SPX :(
 
Last edited:

Patshan

New member
VIP
Hi Ben,
I used this indicator on my old Tradestation platform. Is it possible to code for the heatmap? Being a visual vs. numbers trader, I found this to be the most helpful with Hawkeye. Thanks for all the work you do. It is profoundly helpful for a luddite like me.
 

Zetta_wow

New member
VIP
Update (7/12): nevermind. Sorry for the unnecessary post. I had reused a Custom Quote entry in the watchlist. The previous script was set for an intraday aggregation period, not daily. I thought I had changed that when I entered the new script, but apparently I forgot to do that. After fixing the script aggregation, it works.

I'm trying to create a watchlist column to show the current status of the Hawkeye Volume Indicator (HVI) - at least the color of the histogram bar. I've modified the code from post #1 in this thread, but it's not working consistently. Some stocks or indices give the correct result (when comparing to the study on a chart), but others are wrong. Can anyone help me figure out what's going on?

Examples from today (7/11/22, after market close):
Correct bar color shown in watchlist: GOOGL (red), AMZN (red), MSFT (gray)
Incorrect bar color shown in watchlist: NVDA (gray in WL, red on chart study), NFLX (green in WL, red on chart), TSLA (gray on WL, red on chart)


Here's the code I have for the watchlist column:

Code:
# HawkEye Volume Indicator
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/gci6llVF-Indicator-HawkEye-Volume-Indicator/

plot vol = volume;

def length = 200;
def divisor = 1.5;
def range = high - low;
def rangeAvg = simpleMovingAvg(range, length);
def volumeA = simpleMovingAvg(volume, length);

def high1 = high[1];
def low1 = low[1];
def mid1 = hl2[1];

def u1 = mid1 + (high1 - low1) / divisor;
def d1 = mid1 - (high1 - low1) / divisor;

def r_enabled1 = (range > rangeAvg) and(close < d1) and volume > volumeA;
def r_enabled2 = close < mid1;
def r_enabled = r_enabled1 or r_enabled2;

def g_enabled1 = close > mid1;
def g_enabled2 = (range > rangeAvg) and (close > u1) and (volume > volumeA);
def g_enabled3 = (high > high1) and(range < rangeAvg / 1.5) and (volume < volumeA);
def g_enabled4 = (low < low1) and (range < rangeAvg / 1.5) and (volume > volumeA);
def g_enabled = g_enabled1 or g_enabled2 or g_enabled3 or g_enabled4;

def gr_enabled1 = (range > rangeAvg) and (close > d1) and (close < u1) and (volume > volumeA) and (volume<volumeA * 1.5) and(volume > volume[1]);
def gr_enabled2 = (range < rangeAvg / 1.5) and (volume < volumeA / 1.5);
def gr_enabled3 = (close > d1) and (close < u1);
def gr_enabled = gr_enabled1 or gr_enabled2 or gr_enabled3;

AddLabel(yes, if gr_enabled then "Gray" else if g_enabled then "Green" else if r_enabled then "Red" else "White");
assignBackgroundColor(if gr_enabled then color.gray else if g_enabled then color.green else if r_enabled then color.red else color.white);
 
Last edited:

samer800

Active member
I'm trying to create a watchlist column to show the current status of the Hawkeye Volume Indicator (HVI) - at least the color of the histogram bar. I've modified the code from post #1 in this thread, but it's not working consistently. Some stocks or indices give the correct result (when comparing to the study on a chart), but others are wrong. Can anyone help me figure out what's going on?

Examples from today (7/11/22, after market close):
Correct bar color shown in watchlist: GOOGL (red), AMZN (red), MSFT (gray)
Incorrect bar color shown in watchlist: NVDA (gray in WL, red on chart study), NFLX (green in WL, red on chart), TSLA (gray on WL, red on chart)

Here's the code I have for the watchlist column:

Code:
# HawkEye Volume Indicator
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/gci6llVF-Indicator-HawkEye-Volume-Indicator/

plot vol = volume;

def length = 200;
def divisor = 1.5;
def range = high - low;
def rangeAvg = simpleMovingAvg(range, length);
def volumeA = simpleMovingAvg(volume, length);

def high1 = high[1];
def low1 = low[1];
def mid1 = hl2[1];

def u1 = mid1 + (high1 - low1) / divisor;
def d1 = mid1 - (high1 - low1) / divisor;

def r_enabled1 = (range > rangeAvg) and(close < d1) and volume > volumeA;
def r_enabled2 = close < mid1;
def r_enabled = r_enabled1 or r_enabled2;

def g_enabled1 = close > mid1;
def g_enabled2 = (range > rangeAvg) and (close > u1) and (volume > volumeA);
def g_enabled3 = (high > high1) and(range < rangeAvg / 1.5) and (volume < volumeA);
def g_enabled4 = (low < low1) and (range < rangeAvg / 1.5) and (volume > volumeA);
def g_enabled = g_enabled1 or g_enabled2 or g_enabled3 or g_enabled4;

def gr_enabled1 = (range > rangeAvg) and (close > d1) and (close < u1) and (volume > volumeA) and (volume<volumeA * 1.5) and(volume > volume[1]);
def gr_enabled2 = (range < rangeAvg / 1.5) and (volume < volumeA / 1.5);
def gr_enabled3 = (close > d1) and (close < u1);
def gr_enabled = gr_enabled1 or gr_enabled2 or gr_enabled3;

AddLabel(yes, if gr_enabled then "Gray" else if g_enabled then "Green" else if r_enabled then "Red" else "White");
assignBackgroundColor(if gr_enabled then color.gray else if g_enabled then color.green else if r_enabled then color.red else color.white);
i use this

# HawkEye Volume Indicator
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/gci6llVF-Indicator-HawkEye-Volume-Indicator/
input length = 200;
input divisor = 3.6;
def range = high - low;
def rangeAvg = simpleMovingAvg(range, length);
def volumeA = simpleMovingAvg(volume, length);

def high1 = high[1];
def low1 = low[1];
def mid1 = hl2[1];

def u1 = mid1 + (high1 - low1) / divisor;
def d1 = mid1 - (high1 - low1) / divisor;

def r_enabled1 = (range > rangeAvg) and(close < d1) and volume > volumeA;
def r_enabled2 = close < mid1;
def r_enabled = r_enabled1 or r_enabled2;

def g_enabled1 = close > mid1;
def g_enabled2 = (range > rangeAvg) and(close > u1) and(volume > volumeA);
def g_enabled3 = (high > high1) and(range<rangeAvg/1.5) and(volume<volumeA);
def g_enabled4 = (low < low1) and(range<rangeAvg/1.5) and(volume > volumeA);
def g_enabled = g_enabled1 or g_enabled2 or g_enabled3 or g_enabled4;

def gr_enabled1 = (range > rangeAvg) and(close > d1) and(close<u1) and(volume > volumeA) and(volume<volumeA*1.5) and(volume > volume[1]);
def gr_enabled2 = (range < rangeAvg / 1.5) and(volume<volumeA/1.5);
def gr_enabled3 = (close > d1) and(close<u1);
def gr_enabled = gr_enabled1 or gr_enabled2 or gr_enabled3;

def avgvol = volume(Period = aggregationPeriod.DAY);

assignbackgroundColor(if gr_enabled then color.gray else if g_enabled then color.green else if r_enabled then color.red else color.white);

addlabel( yes, ROUND(avgvol/1000,0) +"M", Color.Black);
 

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

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?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Top