VolumeAvg Arrow

Batman

Member
I have a fairly simple idea. I'd like to have my VolumeAvg indicator show breakout signals like most of the other indicators, by showing a green arrow over each bullish volume bar that crosses the VolAvg line and a red arrow over each bearish volume bar that crosses the VolAvg line. TOS already has a VolumeAvg indicator, of course, but it does not offer the "show breakout signals" tab that many other indicators offer.

My plan is to place low float stocks that are gapping pre-market on a watchlist, then put those stocks on a grid so that I can track them all at once. I'd be looking for the VolumeAvg arrows as potential buy signals, the key word being "potential" because of course not every spike in volume leads to an uptrend. But for low float gappers, I would think this VolumeAvg strategy has some potential, if the goal is getting in early on some exponential growth.
 
Duplicate TOS's VolumeAvg study and add this to the bottom.

Ruby:
plot Buy = if close > open and volume > VolAvg then volume else Double.NaN;
Buy.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Buy.SetDefaultColor(Color.UPTICK);

plot Sell = if close < open and volume > VolAvg then volume else Double.NaN;
Sell.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Sell.SetDefaultColor(Color.RED);
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Duplicate TOS's VolumeAvg study and add this to the bottom.

Ruby:
plot Buy = if close > open and volume > VolAvg then volume else Double.NaN;
Buy.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Buy.SetDefaultColor(Color.UPTICK);

plot Sell = if close < open and volume > VolAvg then volume else Double.NaN;
Sell.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Sell.SetDefaultColor(Color.RED);
Thanks so much! Added it to a scanner at first by accident and it wasn't working, but it's great as a study in the charts section.
 
Last edited:
Thanks so much! Added it to a scanner at first by accident and it wasn't working, but it's great as a study in the charts section.
Duplicate TOS's VolumeAvg study and add this to the bottom.

Ruby:
plot Buy = if close > open and volume > VolAvg then volume else Double.NaN;
Buy.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Buy.SetDefaultColor(Color.UPTICK);

plot Sell = if close < open and volume > VolAvg then volume else Double.NaN;
Sell.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Sell.SetDefaultColor(Color.RED);
If it's not a hassle, is it also possible to turn this idea into a strategy? It might be great on the quick charts, but it would have to be an upper study instead of a lower study to show up there. I'm thinking once I pull up a stock, I would check for arrow signals on the main chart (1m), and keep an eye out for VolumeAvg signals on the quick charts as well for confirmation (I have one set at 5m and another at 15m).
 
If it's not a hassle, is it also possible to turn this idea into a strategy? It might be great on the quick charts, but it would have to be an upper study instead of a lower study to show up there. I'm thinking once I pull up a stock, I would check for arrow signals on the main chart (1m), and keep an eye out for VolumeAvg signals on the quick charts as well for confirmation (I have one set at 5m and another at 15m).

To turn that into a strategy, copy the code, switch to the Strategies tab and create it again in there. Use the AddOrder function to buy and sell based on the same conditions:
close > open and volume > VolAvg
close < open and volume > VolAvg

You're going to need to decide what price you're entering at, what will trigger an exit, etc.
 
To turn that into a strategy, copy the code, switch to the Strategies tab and create it again in there. Use the AddOrder function to buy and sell based on the same conditions:
close > open and volume > VolAvg
close < open and volume > VolAvg

You're going to need to decide what price you're entering at, what will trigger an exit, etc.
Thank you! Ok, last question, if you're up for these basic kinds of questions. For the declare_lower line, do I simply replace "lower" with "upper"? Turning "lower" into "upper" seems to replace the price action with the volume bars. Edit: I removed the reference to upper and the main chart has still turned the price action into volume bars, so there's something more I need to do to turn that lower study into an upper study. Sorry, I'm just unfamiliar with coding like this.

I'm thinking of entering anytime a bullish volume bar crosses the volume average and selling anytime the bearish volume bar crosses the volume average. It's an simplistic strategy for now.

My attempted code looks like this (I attempted versions with and without the two declarations, but it's not working):

declare upper;
declare zerobase;

input length = 50;

plot Vol = volume;
plot VolAvg = Average(volume, length);

Vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Vol.SetLineWeight(3);
Vol.DefineColor("Up", Color.UPTICK);
Vol.DefineColor("Down", Color.DOWNTICK);
Vol.AssignValueColor(if close > close[1] then Vol.color("Up") else if close < close[1] then Vol.color("Down") else GetColor(1));
VolAvg.SetDefaultColor(GetColor(8));

plot Buy = if close > open and volume > VolAvg then volume else Double.NaN;
Buy.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Buy.SetDefaultColor(Color.UPTICK);

plot Sell = if close < open and volume > VolAvg then volume else Double.NaN;
Sell.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Sell.SetDefaultColor(Color.RED);

addOrder(OrderType.BUY_AUTO, close > open and volume > VolAvg);
addOrder (OrderType.Sell_Auto, close < open and volume > VolAvg);
 
Last edited:
Thank you! Ok, last question, if you're up for these basic kinds of questions. For the declare_lower line, do I simply replace "lower" with "upper"? Turning "lower" into "upper" seems to replace the price action with the volume bars. Edit: I removed the reference to upper and the main chart has still turned the price action into volume bars, so there's something more I need to do to turn that lower study into an upper study. Sorry, I'm just unfamiliar with coding like this.

I'm thinking of entering anytime a bullish volume bar crosses the volume average and selling anytime the bearish volume bar crosses the volume average. It's an simplistic strategy for now.

Actually, for the strategy you need almost none of that. Otherwise you get a bunch of stuff you don't want displaying with the candles. I forgot that was going to render giant volume bars.

Ruby:
input length = 50;

def VolAvg = Average(volume, length);

addOrder(OrderType.BUY_AUTO, close > open and volume > VolAvg);
addOrder (OrderType.Sell_Auto, close < open and volume > VolAvg);
 
Actually, for the strategy you need almost none of that. Otherwise you get a bunch of stuff you don't want displaying with the candles. I forgot that was going to render giant volume bars.

Ruby:
input length = 50;

def VolAvg = Average(volume, length);

addOrder(OrderType.BUY_AUTO, close > open and volume > VolAvg);
addOrder (OrderType.Sell_Auto, close < open and volume > VolAvg);
Thanks! This is so good. Is it possible for it to show just arrows? The bubbles cover up so much of the price action.
 
Thanks! This is so good. Is it possible for it to show just arrows? The bubbles cover up so much of the price action.

No, we have no control over the style of the strategy entries and exits except for their color. If you don't care about TOS's P&L tracking and position reporting that only work for strategies then making a regular script that has just arrows would put less noise on the chart.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
381 Online
Create Post

Similar threads

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.
Back
Top