• Get $40 off VIP by signing up for a free account! Sign Up

Volume Signal and code request

rlohmeyer

Active member
Hi,

This is code for a volume signal to tell me which bars have either volume greater than the last 5 bars (not based on an average but by looking at the volume for each of the previous 5 bars and comparing to the present bar). I am using this instead of having to move attention off price action and allows me to assess what I would refer to as commitment based on the bar and the signal. These often assist in showing potential exhaustion of a move or lack of commitment to the continuation of a move.

The one issue I have with the code that I would like some assistance with is the fact that the signal for a low volume bar is placed incorrectly. Since assessing low volume would show the signal at the get go on a bar I had to make the assessment of low volume after the completion of the bar, and the code reflects that. However, the placement of the signal should be previous bar, rather than the present bar. I have searched for a way to move the signal back by one bar but could not come up with a way. If any of you great coders coder could help, would appreciate it.
Here is a chart of NVDA for todays trade which shows the indicator at the low of 3 bars that would give useful information as to the potential for a brake out above the VWAP.

The code is useful as is but if anyone can adjust so that the signal on the low of each bar can be auto moved back by one bar it would make assessment easier and quicker. Thanks. Here is the image and the code below it. PS: the code skips the first 30 minutes of trade as the opening range period, which I don't trade.

nvda.jpg


declare upper;

input OpenTime = 0930;
input OpenRangeMinutes = 30;
def OpenRangeTime = if SecondsFromTime(OpenTime) < 60 * OpenRangeMinutes then 1 else 0;

def v = volume;
def sigh = if !OpenRangeTime and v > v[1] and v > v[2] and v > v[3] and v > v[4] and v > v[5] then 1 else 0;
def sigl = if !OpenRangeTime and v[1] < v[2] and v[1] < v[3] and v[1] < v[4] and v[1] < v[5] and v[1] < v[6] then 1 else 0;
def offset = -1;

plot vsigh = sigh == 1;
vsigh.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
vsigh.SetDefaultColor(Color.YELLOW);
vsigh.SetLineWeight(3);

plot vsigl = sigl == 1;
vsigl.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
vsigl.SetDefaultColor(Color.YELLOW);
vsigl.SetLineWeight(3);
 
Question1: so you pointed out in the picture by drawing a square around the three lower wedges. you would like for each one of those wedges to be shifted back 1 bar?

Question2: and i assume the higher wedges are fine?
 
Correct, the higher wedges are fine. I thankyou for your response, but I tried to define the condition of a finished bar as opposed to one that is still forming.

Here is the code. If you have moment do you think this should work to delay the visibility of the Boolean wedge below a low volume bar?

Code:
declare upper;

input OpenTime = 0930;
input OpenRangeMinutes = 30;
def OpenRangeTime = if SecondsFromTime(OpenTime) < 60 * OpenRangeMinutes then 1 else 0;
def FormingBar = !IsNaN(open) and IsNaN(open [-1] ) ;  # This is 1 if true and 0 is false.
def v = volume;


plot sigh = !OpenRangeTime and v > v[1] and v > v[2] and v > v[3] and v > v[4] and v > v[5];
sigh.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
sigh.SetDefaultColor(Color.YELLOW);
sigh.SetLineWeight(3);

plot sigl = !OpenRangeTime and !FormingBar and v < v[1] and v < v[2] and v < v[3] and v < v[4] and v < v[5];
sigl.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
sigl.SetDefaultColor(Color.YELLOW);
sigl.SetLineWeight(3);
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
364 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