Request for Buy / sell volume pressure in Trend chart pattern

rajaodu1

Member
VIP
Hi Script gurus

I am looking at these volume pressure histogram bars (https://usethinkscript.com/threads/...ssure-indicators-labels-for-thinkorswim.8466/) and wanted to see the histogram charts in different way like a trend chart. Can you please help to write the script. Here is the logic I am thinking.

Lets take 5 min candle chart. The time / count always starts at 6 PM (EST) and resets next day at 6 PM (EST).


1. At 6 PM, there was 0 volume
2. Between 6.00 - 6.05 PM, there was 100 BUY volume, so the chart goes +100 Up
3. Between 6.05 - 6.10 PM, there was another 100 BUY volume, so the next candle starts at 101 and goes all the way up until 200
4. Between 6.10 - 6. 12 PM, there was another 50 BUY volume, so the next candle starts at 201 and goes all the way up until 250
4a. Between 6.12 - 6.14 PM, there was 100 SELL volume, so the candle goes down from 250 to 150.
4b. Between 6.14 - 6.15 PM, there ws 150 BUY volume, so that candle goes up from 150 to 300. While creating a wick between 150 - 200
5. Between 6.15 - 6.17 PM, there was 300 BUY volume, so the next candle starts at 301 and goes all the way up to 600
5a. Between 6.17 - 6.20 PM, there was 400 SELL volume, so the candle moves down from 600 - 200. While creating a wick between 600 - 301
6. Between 6.20 PM - 6.25 PM, there was 400 SELL volume, so the candle starts at 199 and goes all the way down till -200
7. Between 6.25 - 6.27 PM, there was 50 BUY volume, so the candle starts at -199 and goes up to -150.
7a. Betwen 6.27 PM - 6.30 PM, there was 350 SELL volume, so the candle goes down till -500. While creating a wick from -150 - -200

and so on. This logic ccan be used in all time frame. Hope I am explaining clearly. Thanks for your help




1753824206706.png
 
Solution
@rajaodu1 Can't show wicks as intrabar price/volume changes are not usable, but this should be pretty close.
LfnDkj6.jpeg

Ruby:
declare lower;

input Reset_Time = 1800;

def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def BV = V * (C - L) / (H - L);
def SV = V * (H - C) / (H - L);
def HALine = if secondstilltime(Reset_Time)==0 then BV-SV else if IsNaN(HALine[1]+(BV-SV)) then 0 else HALine[1]+(BV-SV);

plot Zero = 0;
plot HAplot = HALine;
HAplot.hide();

def ghaopen = if secondstilltime(Reset_Time)==0 then 0 else HAplot[1];
def ghaclose = if HAplot >= HAplot[1] then HAplot else double.nan;
def ghalow = if HAplot <= HAplot[1] then HAplot else ghaopen;
def ghahigh = if HAplot >=...
@rajaodu1 Can't show wicks as intrabar price/volume changes are not usable, but this should be pretty close.
LfnDkj6.jpeg

Ruby:
declare lower;

input Reset_Time = 1800;

def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def BV = V * (C - L) / (H - L);
def SV = V * (H - C) / (H - L);
def HALine = if secondstilltime(Reset_Time)==0 then BV-SV else if IsNaN(HALine[1]+(BV-SV)) then 0 else HALine[1]+(BV-SV);

plot Zero = 0;
plot HAplot = HALine;
HAplot.hide();

def ghaopen = if secondstilltime(Reset_Time)==0 then 0 else HAplot[1];
def ghaclose = if HAplot >= HAplot[1] then HAplot else double.nan;
def ghalow = if HAplot <= HAplot[1] then HAplot else ghaopen;
def ghahigh = if HAplot >= HAplot[1] then HAplot else ghaclose;

AddChart(growColor = color.green, fallColor = Color.red, neutralColor = Color.current, high = ghahigh, low = ghalow, open = ghaopen, close = ghaclose, type = ChartType.CANDLE);

def rhaopen = if secondstilltime(Reset_Time)==0 then 0 else HAplot[1];
def rhaclose = if HAplot < HAplot[1] then HAplot else double.nan;
def rhalow = if HAplot <= HAplot[1] then HAplot else rhaclose;
def rhahigh = if HAplot >= HAplot[1] then HAplot else rhaopen;

AddChart(growColor = color.red, fallColor = Color.green, neutralColor = Color.current, high = rhahigh, low = rhalow, open = rhaopen, close = rhaclose, type = ChartType.CANDLE);
 
Solution

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
200 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