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.
 

horserider

Well-known member
VIP
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.
 

YungTraderFromMontana

Well-known member
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.
 

XeoNoX

Well-known member
VIP
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
 

vro3

Member
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!
 

TonXas

New member
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
 

JP382

Member
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???
 

Pensar

Well-known member
VIP
@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 😄
 

Pensar

Well-known member
VIP
@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.
 

Similar threads

Top