Having trouble getting an infinite vertical cloud to plot on upper chart

Glefdar

Active member
Hi all, I don't understand why this isn't working because I recycled the AddCloud code from another study that I made in which it works correctly:

Code:
def hasbuysignal = if (buysignal1 or buysignal2 or buysignal3 or buysignal4 or buysignal5 or buysignal6 or buysignal7 or buysignal8) then 1 else 0;

def hasbuysignalonlycloud = if (hasbuysignal ==1 and !KBArUp) then Double.POSITIVE_INFINITY else Double.Nan;
AddCloud(hasbuysignalonlycloud, -hasbuysignalonlycloud, Color.WHITE, Color.Black);

Any idea why this wouldn't work?
 
Looking for code to make a vertical cloud for the background of the upper chart to turn color at trigger point till next trigger point.

I know the entire background can turn color but I do not want the entire background I want to be able to see the lines for the turns easily

Example:

If I want the background to color at the 8 ema crossing the 21 ema up turn green and stay green till it crosses to the opposite way crossing down and turns red.

so lets say my code creates a trigger we would see green till the code says trigger is over or no trigger yet. so say background is black or white the cloud would show green then no trigger so then normal background of black or white and then trigger so green or red vertical cloud. If that makes sense.

I have seen it so I know it can be done I just cant find that study where I saw it .Thanks
 
Looking for code to make a vertical cloud for the background of the upper chart to turn color at trigger point till next trigger point.

I know the entire background can turn color but I do not want the entire background I want to be able to see the lines for the turns easily

Example:

If I want the background to color at the 8 ema crossing the 21 ema up turn green and stay green till it crosses to the opposite way crossing down and turns red.

so lets say my code creates a trigger we would see green till the code says trigger is over or no trigger yet. so say background is black or white the cloud would show green then no trigger so then normal background of black or white and then trigger so green or red vertical cloud. If that makes sense.

I have seen it so I know it can be done I just cant find that study where I saw it .Thanks

Try this

Screenshot-2021-08-05-145256.png
Ruby:
plot ema1 = ExpAverage(close, 8);
plot ema2 = ExpAverage(close, 21);
def emaup = ema1 > ema2;

def cond1 = if emaup
          then Double.POSITIVE_INFINITY
          else Double.NEGATIVE_INFINITY;
def cond2 = if !emaup
          then Double.POSITIVE_INFINITY
          else Double.NEGATIVE_INFINITY;
input showclouds = yes;
AddCloud(if showclouds
         then cond1
         else Double.NaN,
         cond2,
         Color.GREEN, Color.RED);
 
Looking for code to make a vertical cloud for the background of the upper chart to turn color at trigger point till next trigger point.

I know the entire background can turn color but I do not want the entire background I want to be able to see the lines for the turns easily

Example:

If I want the background to color at the 8 ema crossing the 21 ema up turn green and stay green till it crosses to the opposite way crossing down and turns red.

so lets say my code creates a trigger we would see green till the code says trigger is over or no trigger yet. so say background is black or white the cloud would show green then no trigger so then normal background of black or white and then trigger so green or red vertical cloud. If that makes sense.

I have seen it so I know it can be done I just cant find that study where I saw it .Thanks

This will get you a 'spaced' version at the change overs in case that is what you were looking to get.

Ruby:
plot ema1 = ExpAverage(close, 8);
plot ema2 = ExpAverage(close, 21);
def emaup = ema1 > ema2;

input showclouds = yes;
AddCloud(if showclouds and emaup
         then  Double.POSITIVE_INFINITY
         else Double.NaN,
         Double.negative_INFINITY,
         Color.GREEN, Color.green);
AddCloud(if showclouds and !emaup
         then  Double.POSITIVE_INFINITY
         else Double.NaN,
         Double.negative_INFINITY,
         Color.red, Color.RED)
 

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
318 Online
Create Post

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