Input candle color

Amarante

Member
VIP
I currently have the following code in a script to hide the red candles so I focus on green up candles to get me out of trades sooner:

AssignPriceColor(if ColoredCandlesOn and (priceColor == 1) then Color.GREEN else if ColoredCandlesOn and (priceColor == -1) then Color.DARK_GRAY else Color.DARK_GRAY);

I would like to be able to select the color of the red candle from a group of three colors (Red, Blue, Dark_Gray) so that I can adjust the color of the candles in Settings on different time frames since my longer time frame charts don't require a quick response.

Thanks for your help.
 
Solution
I included the following into the script:

input Color1_choice = {default "magenta", "cyan", "pink", "gray", "orange", "red", "green", "dark_gray", "yellow", "white"};

and replaced

AssignPriceColor(if ColoredCandlesOn and (priceColor == 1) then Color.GREEN else if ColoredCandlesOn and (priceColor == -1) then Color.DARK_GRAY else Color.DARK_GRAY);

with:

AssignPriceColor(if ColoredCandlesOn and (priceColor == 1) then Color.LIME else if ColoredCandlesOn and (priceColor == -1) then
GetColor(Color1_choice) else GetColor(Color1_choice);

but get an Invalid Statement.

Assuming the missing data (coloredcandleson and pricecolor) is also valid in your script, then your replacement is just missing a closing parenthesis ')'

I currently have the following code in a script to hide the red candles so I focus on green up candles to get me out of trades sooner:

AssignPriceColor(if ColoredCandlesOn and (priceColor == 1) then Color.GREEN else if ColoredCandlesOn and (priceColor == -1) then Color.DARK_GRAY else Color.DARK_GRAY);

I would like to be able to select the color of the red candle from a group of three colors (Red, Blue, Dark_Gray) so that I can adjust the color of the candles in Settings on different time frames since my longer time frame charts don't require a quick response.

Thanks for your help.

here is an example that uses an input to pick a color.
https://usethinkscript.com/threads/label-color-in-thinkscript.4045/page-3#post-67014

note, the color names don't mean anything. all the colors could be replaced with x1, x2,x3,.. and it would work the same. it is the position number in the list that is returned, the nth parameter. that is used as a parameter for getcolor( ).

-------------

example on using RGB color numbers
https://usethinkscript.com/threads/...for-custom-watchlist-column.10675/#post-94315
 
Last edited:
here is an example that uses an input to pick a color.
https://usethinkscript.com/threads/label-color-in-thinkscript.4045/page-3#post-67014

note, the color names don't mean anything. all the colors could be replaced with x1, x2,x3,.. and it would work the same. it is the position number in the list that is returned, the nth parameter. that is used as a parameter for gercolor( ).

-------------

example on using RGB color numbers
https://usethinkscript.com/threads/...for-custom-watchlist-column.10675/#post-94315
I included the following into the script:

input Color1_choice = {default "magenta", "cyan", "pink", "gray", "orange", "red", "green", "dark_gray", "yellow", "white"};

and replaced

AssignPriceColor(if ColoredCandlesOn and (priceColor == 1) then Color.GREEN else if ColoredCandlesOn and (priceColor == -1) then Color.DARK_GRAY else Color.DARK_GRAY);

with:

AssignPriceColor(if ColoredCandlesOn and (priceColor == 1) then Color.LIME else if ColoredCandlesOn and (priceColor == -1) then
GetColor(Color1_choice) else GetColor(Color1_choice);

but get an Invalid Statement.
 
Last edited:
I included the following into the script:

input Color1_choice = {default "magenta", "cyan", "pink", "gray", "orange", "red", "green", "dark_gray", "yellow", "white"};

and replaced

AssignPriceColor(if ColoredCandlesOn and (priceColor == 1) then Color.GREEN else if ColoredCandlesOn and (priceColor == -1) then Color.DARK_GRAY else Color.DARK_GRAY);

with:

AssignPriceColor(if ColoredCandlesOn and (priceColor == 1) then Color.LIME else if ColoredCandlesOn and (priceColor == -1) then
GetColor(Color1_choice) else GetColor(Color1_choice);

but get an Invalid Statement.

Assuming the missing data (coloredcandleson and pricecolor) is also valid in your script, then your replacement is just missing a closing parenthesis ')'

Ruby:
AssignPriceColor(
if coloredcandleson and (pricecolor == 1) then Color.lime
else if coloredcandleson and (pricecolor == -1) then getcolor(Color1_choice)
else getcolor(Color1_choice));
 
Solution

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