• Get $40 off VIP by signing up for a free account! Sign Up

How to modify thinkScript transparent (opacity) color?

YungTraderFromMontana

Well-known member
I'm trying to overlay accumulation distribution on my chart but the color are too bright and distracting. Could anyone make it so the colors are more see through and don't clash with the candles. I know their is a feature on volume profile to do this but I can't replicate it on other indicators.

Here's the accumulation distribution code:

Code:
declare lower;
input length = 6;
input factor = 0.95;
input mode = {default Range, ATR};

def range;
switch (mode) {
case Range:
    range = Highest(high, length) - Lowest(low, length);

case ATR:
    range = reference ATR();
}

plot RangeRatio = (range / range[length])/2;
plot RangeFactor = factor/2;

RangeRatio.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
RangeRatio.DefineColor("Consolidation", GetColor(4));
RangeRatio.DefineColor("Non-consolidation", GetColor(1));

RangeRatio.AssignValueColor( if (RangeRatio < RangeFactor) then RangeRatio.Color("Consolidation") else RangeRatio.Color("Non-consolidation"));
RangeFactor.SetDefaultColor(GetColor(7));

RangeRatio.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
RangeRatio.DefineColor("Consolidation", GetColor(4));
RangeRatio.DefineColor("Non-consolidation", GetColor(1));

RangeRatio.AssignValueColor( if (RangeRatio < RangeFactor) then RangeRatio.Color("Consolidation") else RangeRatio.Color("Non-consolidation"));
RangeFactor.SetDefaultColor(GetColor(7));

Here is the opacity control feature in volume profile:

Code:
input showPointOfControl = yes;
input showValueArea = yes;
input valueAreaPercent = 70;
input opacity = 50;

DefineGlobalColor("Profile", GetColor(1));
DefineGlobalColor("Point Of Control", GetColor(5));
DefineGlobalColor("Value Area", GetColor(8));
vol.show(globalColor("Profile"), if showPointOfControl then globalColor("Point Of Control") else color.current, if showValueArea then globalColor("Value Area") else color.current, opacity);

I would like the end goal to be an opacity control of the rangeratio.
 
Do not know if it is possible. SHOW is defined as "This function controls visibility and color scheme of Time, Volume, and Monkey Bars profiles. Note that profiles calculated by the corresponding functions will only be visible if the Show function is applied to them. " Opacity is one of the inputs available.

Maybe use Createcolor and find a pastel that works.
 
Do not know if it is possible. SHOW is defined as "This function controls visibility and color scheme of Time, Volume, and Monkey Bars profiles. Note that profiles calculated by the corresponding functions will only be visible if the Show function is applied to them. " Opacity is one of the inputs available.

Maybe use Createcolor and find a pastel that works.
That worked, I didn't know transparency was an option when picking colors.
 
yes you can make it transparent ( lighter or darker - see through ) pretty much same as changing opacity in thinkorswim thinkscript on volume profile

ev3lcln.png
 
Hey all! Is there a way to make the overall opacity of a study less?
Thanks!

EDIT:
FOUND IT. Color -> more colors. then RGB . etc. there's an option!
 
I'm trying to make my moving averages more translucent, but this error message keeps popping up. Help

Code:
input showOnlyLastPeriod = yes;
DefineGlobalColor("Red", Color.RED);
input opacity = 50;
input length5 = 5;
plot AVG = ExpAverage( close, length5);
avg.Show(GlobalColor("red"), if showOnlyLastPeriod then GlobalColor("red") else Color.CURRENT, opacity);

!Error Message!
Can not call Show on avg at 12:1
Expected class com.devexperts.tos.thinkscript.data.CustomColor at 12:5
Can not call Show on avg at 12:1
Expected class com.devexperts.tos.thinkscript.data.CustomColor at 12:5
 
I know you can make actual studies transparent but is there a way to do it to a label? What if you just want the info to appear and dont need the colored box around it? I know some will say make the background white and text color black or whatever but is there a way for NO background and just display the text???
 
@JP382 To my knowledge, its not possible. Besides, the text in the labels is the same color as the color of the chart background, so even if it were possible, you wouldn't be able to read what the label says.

Looks like we posted at the same time @MerryDay 😄
 
@JP382 Changing the color of the label is easy enough. you can also get the RGB color and use CreateColor() for any custom color you like. Yet the label will never be fully "transparent" because the label text takes its color from the chart background. The most likely thing that will happen is that the label will become so faint as to cause eye strain when trying to read it. I've tried this as well, and ended up using the basic gray or neutral-dark colors with a black background.
 
there is no code. he changed a setting in settings.
read all of this thread and follow the link in post12.

Ah, thanks.

Is GlobalColor the only way to use opacity? I originally used an if/then statement with CreateColor so it could change during certain times. Seems like it's either one or the other, because I can't get an if/then to work with Global.
 

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