Custom color from dropdown inputs

wes.

New member
Hey there, I am new to thinkscript and would greatly appreciate any help. I would like to add a custom color to this input's drop down menu:

JLeavTa.png


The custom color I would like to use is:

MnoGw1T.jpg


this is the study's script:

Code:
input Period = aggregationPeriod.HOUR;
input AvgType = averageType.EXPONENTIAL;
input FastLength = 72;
input SlowLength = 89;
input priceclose = close;
input CloudColorBull = {"MAGENTA", "CYAN", "PINK", "LIGHT_GRAY", "ORANGE", "RED", "GREEN", default "GRAY", "WHITE"};
input CloudColorBear = {"MAGENTA", "CYAN", "PINK", "LIGHT_GRAY", "ORANGE","RED", "GREEN",default "GRAY", "WHITE"};

plot fastAVG = MovingAverage(AvgType, close(period = Period), FastLength);
plot slowAVG = MovingAverage(AvgType,close(period = Period), SlowLength);
fastAVG.setdefaultcolor(color.white);
fastAVG.setStyle(curve.SHORT_DASH);
slowAVG.setdefaultcolor(color.white);
slowAVG.setStyle(curve.SHORT_DASH);
AddCloud(fastAVG,slowAVG,GetColor(CloudColorBull),GetColor(CloudColorBear));
 
here you go... you can manually set the color code to the the RGB code numbers you want
just change CreateColor(205,0, 0) and CreateColor(29,129, 163) to your wanted numbers


Code:
input Period = aggregationPeriod.HOUR;
input AvgType = averageType.EXPONENTIAL;
input FastLength = 72;
input SlowLength = 89;
input priceclose = close;
plot fastAVG = MovingAverage(AvgType, close(period = Period), FastLength);
plot slowAVG = MovingAverage(AvgType,close(period = Period), SlowLength);
fastAVG.setdefaultcolor(color.white);
fastAVG.setStyle(curve.SHORT_DASH);
slowAVG.setdefaultcolor(color.white);
slowAVG.setStyle(curve.SHORT_DASH);
AddCloud(fastAVG,slowAVG,CreateColor(205,0, 0),CreateColor(29,129, 163));
 
here you go... you can manually set the color code to the the RGB code numbers you want
just change CreateColor(205,0, 0) and CreateColor(29,129, 163) to your wanted numbers


Code:
input Period = aggregationPeriod.HOUR;
input AvgType = averageType.EXPONENTIAL;
input FastLength = 72;
input SlowLength = 89;
input priceclose = close;
plot fastAVG = MovingAverage(AvgType, close(period = Period), FastLength);
plot slowAVG = MovingAverage(AvgType,close(period = Period), SlowLength);
fastAVG.setdefaultcolor(color.white);
fastAVG.setStyle(curve.SHORT_DASH);
slowAVG.setdefaultcolor(color.white);
slowAVG.setStyle(curve.SHORT_DASH);
AddCloud(fastAVG,slowAVG,CreateColor(205,0, 0),CreateColor(29,129, 163));
Awesome! Thank you very much
 
Can anyone tell me how to create a custom color for this code below? The top AddCloud code is defaulted to GlobalColor I am attempting to change this to Color.red or any color I would prefer as I am attempting to do at the bottom but it keeps coming back with an error.

Code:
AddCloud(if rthCheck and showAggregation4 then fvgBear4MH else double.nan, if rthCheck and showAggregation4 then fvgBear4ML else double.nan, GlobalColor("Aggregation 4"));

AddCloud(if rthCheck and showAggregation4 then fvgBull4MH else double.nan, if rthCheck and showAggregation4 then fvgBull4ML else double.nan,  color.dark_green,("Aggregation 4"));
 
Last edited by a moderator:
Can anyone tell me how to create a custom color for this code below? The top AddCloud code is defaulted to GlobalColor I am attempting to change this to Color.red or any color I would prefer as I am attempting to do at the bottom but it keeps coming back with an error.

Code:
AddCloud(if rthCheck and showAggregation4 then fvgBear4MH else double.nan, if rthCheck and showAggregation4 then fvgBear4ML else double.nan, GlobalColor("Aggregation 4"));

AddCloud(if rthCheck and showAggregation4 then fvgBull4MH else double.nan, if rthCheck and showAggregation4 then fvgBull4ML else double.nan,  color.dark_green,("Aggregation 4"));

Your bottom one did not have globalcolor("Aggregation 4") with the ("Aggregation 4"). You can define more globalcolors, if you want more flexibility.
 
Your bottom one did not have globalcolor("Aggregation 4") with the ("Aggregation 4"). You can define more globalcolors, if you want more flexibility.
Yes, the orginal code is written using fixed global color. I am trying to change this to have a custom color so replacing the global color say... the top code is for bearish I would like that to be color.red and the bottom showing bullish change the globalcolor to color.green.
 
Yes, the orginal code is written using fixed global color. I am trying to change this to have a custom color so replacing the global color say... the top code is for bearish I would like that to be color.red and the bottom showing bullish change the globalcolor to color.green.

As I said, create another define global color to do that similar to the existing one. For example, DefineGlobalColor("Another Color", Color.GREEN);
 

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