Is there a way to assign lower background color?

Solution
I have a similar question - I have an indicator that plots against the zero line in a lower panel. Can I make the background of the lower panel green above the zero line and red below the zero line regardless of what the indicator does so that the background above the zero line is always green and below the background is always red?

You can add clouds between zero and positive infinity and negative infinity. I remember correctly, you can disable highlight studies on mouse hover to prevent it from becoming too annoying. It also messes with the right click context menu. Clouds are transparent - repeating them so there are multiple clouds overlapping will make them darker. Personally, I find its better to just change color...
I have a similar question - I have an indicator that plots against the zero line in a lower panel. Can I make the background of the lower panel green above the zero line and red below the zero line regardless of what the indicator does so that the background above the zero line is always green and below the background is always red?
 
I have a similar question - I have an indicator that plots against the zero line in a lower panel. Can I make the background of the lower panel green above the zero line and red below the zero line regardless of what the indicator does so that the background above the zero line is always green and below the background is always red?

You can add clouds between zero and positive infinity and negative infinity. I remember correctly, you can disable highlight studies on mouse hover to prevent it from becoming too annoying. It also messes with the right click context menu. Clouds are transparent - repeating them so there are multiple clouds overlapping will make them darker. Personally, I find its better to just change color of the values rather than the background.

Changing the actual background color with AssignBackgroundColor() from within a study will change the entire chart, not just that of the study.

Code:
declare lower;
plot Histo = open - close;
Histo.setpaintingStrategy(paintingStrategy.HISTOGRAM);
Histo.setdefaultColor(color.blue);
AddCloud(double.POSITIVE_INFINITY,0,color.green);
AddCloud(double.NEGATIVE_INFINITY,0,color.red);

VwgfIYz.png
 
Solution
2023-01-08-FLEXIBLE_GRID2.png

I figured it out playing around with the code here you go guys for whoever wants to change color of lower indicator then can go in settings and customize what global color background you want. I added this to my squeeze code. Hope it helps some of you all. Trying to contribute where I can.

DefineGlobalColor("Background", Createcolor(0,0,0));
def background1 = if oscillator>0 then double.posITIVE_INFINITY else double.NEGATIVE_INFINITY;
AddCloud(background1,-background1, globalcolor("background"), globalcolor("background"));
AddCloud(background1,-background1, globalcolor("background"), globalcolor("background"));
AddCloud(background1,-background1, globalcolor("background"), globalcolor("background"));
AddCloud(background1,-background1, globalcolor("background"), globalcolor("background"));


For RSI I would think just switch out "oscillator" portion to whichever indicator value your using such as RSI.
 
Last edited:
Im coding a rsi script. It would be cool if you could assign just the lower color on the chart

Here you go if this what you looking for, change background of only your lower RSI study. Settings in Global colors can change whatever background.

Code:
#RSI_Custombackground-Coded by DJR
declare lower;

input length = 14;
input over_Bought = 70;
input over_Sold = 30;
input price = close;
input averageType = AverageType.WILDERS;
input showBreakoutSignals = no;

def NetChgAvg = MovingAverage(averageType, price - price[1], length);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

plot RSI = 50 * (ChgRatio + 1);
plot OverSold = over_Sold;
plot OverBought = over_Bought;
plot UpSignal = if RSI crosses above OverSold then OverSold else Double.NaN;
plot DownSignal = if RSI crosses below OverBought then OverBought else Double.NaN;

UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);

RSI.DefineColor("OverBought", GetColor(5));
RSI.DefineColor("Normal", GetColor(7));
RSI.DefineColor("OverSold", GetColor(1));
RSI.AssignValueColor(if RSI > over_Bought then RSI.color("OverBought") else if RSI < over_Sold then RSI.color("OverSold") else RSI.color("Normal"));
OverSold.SetDefaultColor(GetColor(8));
OverBought.SetDefaultColor(GetColor(8));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);

DefineGlobalColor("Background", Createcolor(0,0,0));
def background1 = if RSI>0 then double.posITIVE_INFINITY else double.NEGATIVE_INFINITY;
AddCloud(background1,-background1, globalcolor("background"), globalcolor("background"));
AddCloud(background1,-background1, globalcolor("background"), globalcolor("background"));
AddCloud(background1,-background1, globalcolor("background"), globalcolor("background"));
AddCloud(background1,-background1, globalcolor("background"), globalcolor("background"));
AddCloud(background1,-background1, globalcolor("background"), globalcolor("background"));
 
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
296 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