POC modify

Eyl

New member
Screenshot 2023-11-22 025445.png


Found this script here https://usethinkscript.com/threads/volume-profile.11180/#post-130035 would like to modify it. If anyone can help.

Here is my idea -

The script below last part is where I tried too do my new conditions, no error has come up, but nothing is happening on the chart.

If the price is below POC1 and VALOW want it - Light red else color current
If the Price is above POC1 and VAHIGH1 want it - Light green else color current

Thank you.


Code:
input daysback = 1;  def ymd = GetYYYYMMDD(); def candles = !IsNaN(close); def capture = candles and ymd != ymd[1]; def dayCount = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0); def thisDay = (HighestAll(dayCount) - dayCount);  def poc = if thisDay == daysback then reference VolumeProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no) else poc[1]; def vahigh = if thisDay == daysback then reference VolumeProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no).VAHigh else vahigh[1]; def valow = if thisDay == daysback then reference VolumeProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no).VALow else valow[1];  plot poc1 = if thisDay > daysback then Double.NaN else poc; plot vahigh1 = if thisDay > daysback then Double.NaN else vahigh; plot valow1 = if thisDay > daysback then Double.NaN else valow;  poc1.SetDefaultColor(Color.CYAN); vahigh1.SetDefaultColor(Color.GREEN); valow1.SetDefaultColor(Color.RED);  input bubblemover = 3; def b = bubblemover; def b1 = b + 1; input showbubbles = yes; def decimalPlaces = 2;  AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), poc1[b], +Round(poc1[b], decimalPlaces), Color.CYAN); AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vahigh1[b], +Round(vahigh1[b], decimalPlaces), Color.GREEN); AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), valow1[b], +Round(valow1[b], decimalPlaces), Color.RED, no);

-----# Assign color based on price relationship

AddCloud(Close > POC1 and VAhigh1, Close > POC1 and VAlow1, Color.Light_GREEN, Color.Light_greeN);

AddCloud(Close < POC1 and VAhigh1, Close < POC1 and VAlow1, Color.Light_RED, Color.Light_RED);----
 
Solution
View attachment 20251

Found this script here https://usethinkscript.com/threads/volume-profile.11180/#post-130035 would like to modify it. If anyone can help.

Here is my idea -

The script below last part is where I tried too do my new conditions, no error has come up, but nothing is happening on the chart.

If the price is below POC1 and VALOW want it - Light red else color current
If the Price is above POC1 and VAHIGH1 want it - Light green else color current

Thank you.


Code:
input daysback = 1;  def ymd = GetYYYYMMDD(); def candles = !IsNaN(close); def capture = candles and ymd != ymd[1]; def dayCount = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0); def thisDay = (HighestAll(dayCount) - dayCount);  def poc...
View attachment 20251

Found this script here https://usethinkscript.com/threads/volume-profile.11180/#post-130035 would like to modify it. If anyone can help.

Here is my idea -

The script below last part is where I tried too do my new conditions, no error has come up, but nothing is happening on the chart.

If the price is below POC1 and VALOW want it - Light red else color current
If the Price is above POC1 and VAHIGH1 want it - Light green else color current

Thank you.


Code:
input daysback = 1;  def ymd = GetYYYYMMDD(); def candles = !IsNaN(close); def capture = candles and ymd != ymd[1]; def dayCount = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0); def thisDay = (HighestAll(dayCount) - dayCount);  def poc = if thisDay == daysback then reference VolumeProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no) else poc[1]; def vahigh = if thisDay == daysback then reference VolumeProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no).VAHigh else vahigh[1]; def valow = if thisDay == daysback then reference VolumeProfile("price per row height mode" = "TICKSIZE", "time per profile" = "DAY", "on expansion" = no).VALow else valow[1];  plot poc1 = if thisDay > daysback then Double.NaN else poc; plot vahigh1 = if thisDay > daysback then Double.NaN else vahigh; plot valow1 = if thisDay > daysback then Double.NaN else valow;  poc1.SetDefaultColor(Color.CYAN); vahigh1.SetDefaultColor(Color.GREEN); valow1.SetDefaultColor(Color.RED);  input bubblemover = 3; def b = bubblemover; def b1 = b + 1; input showbubbles = yes; def decimalPlaces = 2;  AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), poc1[b], +Round(poc1[b], decimalPlaces), Color.CYAN); AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vahigh1[b], +Round(vahigh1[b], decimalPlaces), Color.GREEN); AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), valow1[b], +Round(valow1[b], decimalPlaces), Color.RED, no);

-----# Assign color based on price relationship

AddCloud(Close > POC1 and VAhigh1, Close > POC1 and VAlow1, Color.Light_GREEN, Color.Light_greeN);

AddCloud(Close < POC1 and VAhigh1, Close < POC1 and VAlow1, Color.Light_RED, Color.Light_RED);----
Replace your addclouds with:

Code:
AddCloud(if Close > POC1 then VAhigh1 else double.nan, VAlow1, Color.Light_GREEN, Color.Light_greeN);

AddCloud(if Close < POC1 then VAhigh1 else double.nan, VAlow1, Color.Light_RED, Color.Light_RED);
 
Solution
This helped a lot your strategy helped me to modify it.

Thank you!!



Code:
Addcloud(if showcloud and close > vahigh1 or showcloud and close < poc1 and vahigh1 then poc1 else double.nan, vahigh1, color.light_red, color.light_GREEN);
Addcloud(if showcloud and close < valow1 or showcloud and close > poc1 and valow1 then poc1 else double.nan, valow1, color.light_red, color.light_GREEN);
 
Last edited:

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