joshua74133
Member
Im coding a rsi script. It would be cool if you could assign just the lower color on the chart
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?
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);
Im coding a rsi script. It would be cool if you could assign just the lower color on the chart
#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"));
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Start a new thread and receive assistance from our community.
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.
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.