Change opacity of cloud?

temtam

New member
Ok so I've got a set of indicators that use clouds, but it's almost always covering the price. This results in candles that are sometimes hard to see. I'm wondering if it's possible to change the opacity of the cloud, or maybe put the candles in front of the cloud study somehow.

As far as I know, you can only choose specific colors for clouds in the source code. You can change transparency with HSV colors, but my cloud doesn't show up in the "edit properties" window where you can switch to HSV. Is there maybe some way to import an HSV color to use on the cloud? Or make my cloud show up in the "edit properties" window? Any ideas?
 

rad14733

Well-known member
VIP
@temtam You would need to modify the Study code and change the Color.<whatever> to use CreateColor(###, ###, ###)... Another way would be to use Global Colors... I'll leave t to you to research further in the Learning Center... Type in "Color" and you'll get results...
 

mashume

Well-known member
VIP
From funwiththinkscript

you can use an old function:
Code:
AddChart(high = h, low = l, open = o, close = c, type = ChartType.CANDLE, growcolor = color.black);
and work on the order of your plots to make sure it comes out on top (I never remember whether the first plots in your script are on top or on bottom, but ToS draws things in an order based on the order they appear in your script. There is a note in the funwiththinkscript page that says:

"[T]he AddChart() function was deprecated a few years ago and is no longer fully supported. i.e.—While it used to allow for different colors to be used for up, down, or neutral candles; it no longer does."

Use it at your own peril.

happy trading,
mashume
 

SleepyZ

Well-known member
From funwiththinkscript

you can use an old function:
Code:
AddChart(high = h, low = l, open = o, close = c, type = ChartType.CANDLE, growcolor = color.black);
and work on the order of your plots to make sure it comes out on top (I never remember whether the first plots in your script are on top or on bottom, but ToS draws things in an order based on the order they appear in your script. There is a note in the funwiththinkscript page that says:

"[T]he AddChart() function was deprecated a few years ago and is no longer fully supported. i.e.—While it used to allow for different colors to be used for up, down, or neutral candles; it no longer does."

Use it at your own peril.

happy trading,
mashume
Here are two (candle and heiken ashi) workarounds for the deprecated addchart() function to create up/down colored candles.

Code:
#addchart - up/down  candle colors - workaround for the addchart() function not supported by TOS
def o = open;
def c = close;
def h = high;
def l = low;
AddChart(if c > o then h else Double.NaN,
         if c > o then l else Double.NaN,
         if c > o then c else Double.NaN,
         if c > o then o else Double.NaN,
         ChartType.CANDLE, Color.GREEN);
AddChart(if c < o then h else Double.NaN,
         if c < o then l else Double.NaN,
         if c < o then o else Double.NaN,
         if c < o then c else Double.NaN,
         ChartType.CANDLE, Color.RED);
AddChart(if c == o then h else Double.NaN,
         if c == o then l else Double.NaN,
         if c == o then o else Double.NaN,
         if c == o then c else Double.NaN,
         ChartType.CANDLE, Color.WHITE);

Code:
#addchart - up/down heiken ashi candle colors - workaround for the addchart() function not supported by TOS
def HAclose = (open + high + low + close) / 4;
def HAopen  = CompoundValue( 1, ( HAopen[1] + HAclose[1] ) / 2, HAclose );
def HAhigh  = Max(Max(high, HAopen), HAclose);
def HAlow   = Min(Min(low, HAopen), HAclose);

def o = haopen;
def c = haclose;
def h = hahigh;
def l = halow;

AddChart(if c > o then h else Double.NaN,
         if c > o then l else Double.NaN,
         if c > o then c else Double.NaN,
         if c > o then o else Double.NaN,
         ChartType.CANDLE, Color.GREEN);
AddChart(if c < o then h else Double.NaN,
         if c < o then l else Double.NaN,
         if c < o then o else Double.NaN,
         if c < o then c else Double.NaN,
         ChartType.CANDLE, Color.RED);
AddChart(if c == o then h else Double.NaN,
         if c == o then l else Double.NaN,
         if c == o then o else Double.NaN,
         if c == o then c else Double.NaN,
         ChartType.CANDLE, Color.WHITE);
 

temtam

New member
@temtam You would need to modify the Study code and change the Color.<whatever> to use CreateColor(###, ###, ###)... Another way would be to use Global Colors... I'll leave t to you to research further in the Learning Center... Type in "Color" and you'll get results...
I did find CreateColor in the Learning Center but it only accepts 3 values and not the 4 that would be required for HSV, so it's only limited to RGB. Is there any way to set an HSV color as my global color?
 

rad14733

Well-known member
VIP
@temtam No, RGB is the only way to use CreateColor()... There is no Thinkscript function that supports HSV as it is not a standard color convention... HSV can only be selected through the color palette panel...
 

temtam

New member
From funwiththinkscript

you can use an old function:
Code:
AddChart(high = h, low = l, open = o, close = c, type = ChartType.CANDLE, growcolor = color.black);
and work on the order of your plots to make sure it comes out on top (I never remember whether the first plots in your script are on top or on bottom, but ToS draws things in an order based on the order they appear in your script. There is a note in the funwiththinkscript page that says:

"[T]he AddChart() function was deprecated a few years ago and is no longer fully supported. i.e.—While it used to allow for different colors to be used for up, down, or neutral candles; it no longer does."

Use it at your own peril.

happy trading,
mashume

@mashume Someone posted AddChart() code a few weeks ago and I played with it a bit... While it does work, it's a bit quirky... ;) (y)

Here are two (candle and heiken ashi) workarounds for the deprecated addchart() function to create up/down colored candles.

Hmm, I tried AddChart() and my clouds still print above it no matter the order of my indicators...

HxMY833.png


nMjh0ZE.png
 

rad14733

Well-known member
VIP
@temtam Clouds will always paint above the candles regardless of the layer priority you may attempt to implement... I know it's frustrating but that's just a shortcoming of the TOS platform... I've played with the concept extensively and haven't found a work-around... I wish there was... :(
 

Similar threads

Top