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

Similar threads

Top