Native color input with palette/picker for custom study?

gavin

New member
Hello, I'm trying to create a simple custom study that simply changes the color of a bar based on simple criteria.

Is there a way to enable a study input that's just like the color picker for native studies, such as VWAP? When I click the VWAP color swatch, it brings up a palette of preselected colors and I can also click "More" to make a custom color and fine tuned adjustments like HSL and others. I'd really love the ability to do this on a custom study and haven't been able to figure out how to do it. Here's an example of a really simple study I'd like it on:

Code:
AssignPriceColor(if high > high[1] and low < low[1] then Color.CYAN else Color.CURRENT);

Ideally the input would replace the hard coded Color.CYAN so that I can change it quickly using the native color palette input described above.

Thank you for any suggestions!
 

SleepyZ

Active member
Hello, I'm trying to create a simple custom study that simply changes the color of a bar based on simple criteria.

Is there a way to enable a study input that's just like the color picker for native studies, such as VWAP? When I click the VWAP color swatch, it brings up a palette of preselected colors and I can also click "More" to make a custom color and fine tuned adjustments like HSL and others. I'd really love the ability to do this on a custom study and haven't been able to figure out how to do it. Here's an example of a really simple study I'd like it on:

Code:
AssignPriceColor(if high > high[1] and low < low[1] then Color.CYAN else Color.CURRENT);

Ideally the input would replace the hard coded Color.CYAN so that I can change it quickly using the native color palette input described above.

Thank you for any suggestions!
Perhaps this will help.

Code:
defineGlobalColor("UP", color.green);
AssignPriceColor(if high > high[1] and low < low[1] then globalColor("UP") else Color.CURRENT);
Capture.jpg
 

rad14733

Well-known member
VIP
@gavin Yes it can be done... You'll find ample information the the Thinkorswims Learning Center section on Look and Feel section... Specifically, you'll want to research the DefineColor() function which I feel is more elegant than the DefineGlobalColor() function @SleepyZ referenced... Both work... Pick whichever best suits your needs... The difference is in how you change colors in the Study Settings Panel and whether the colors are set for a specific plot or the entire Study...

Was composing while @SleepyZ was replying...
 
Last edited:

Similar threads

Top