Coding A Custom Candle In ThinkOrSwim

LouDiamond

New member
I was interested in creating a candle that paints red or green based on the placement of the high and low of the candle (ignoring the open / close.) So if the high appears before the low, it paints the candle red and if the low appears before the high, it paints green.

You can see from this screen shot that the 4hour chart painted a green candle (left) but if you look at the 1min chart (right) the high of the candle appeared first in sequence, followed by the low of the candle. In this scenario i would prefer if the 4hour candle painted red based on my criterias. please let me know if this is at all possible and if anyone can help code it, thanks


candles.png
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

I was interested in creating a candle that paints red or green based on the placement of the high and low of the candle (ignoring the open / close.) So if the high appears before the low, it paints the candle red and if the low appears before the high, it paints green.

You can see from this screen shot that the 4hour chart painted a green candle (left) but if you look at the 1min chart (right) the high of the candle appeared first in sequence, followed by the low of the candle. In this scenario i would prefer if the 4hour candle painted red based on my criterias. please let me know if this is at all possible and if anyone can help code it, thanks


candles.png

no, data during a candle can't be saved and used, only the values when it closes. during the active candle, formulas react to the instantaneous values, but can't retain any values at specific times during a candle.

no. a chart study can't read data from a time period shorter than what the chart is set up for. a 4hour chart can't read data from 1 minute candles, they don't exist.

having a valley occur after a peak is common. what is interesting is in the 1 minute, after the first peak is a 2nd peak, a lower high.

you could look at smaller time candles and use an overlay study to color a rectangle over many candles, representing the longer time candles. that shading color could be altered.

https://usethinkscript.com/threads/multi-timeframe-candles-overlay-for-thinkorswim.1425/
my version is at post74
https://usethinkscript.com/threads/...verlay-for-thinkorswim.1425/page-4#post-71874


this function is used to change the color of candles.
https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Look---Feel/AssignPriceColor
 
what is interesting is in the 1 minute, after the first peak is a 2nd peak, a lower high.
Yea i believe that 2nd peak was part of the green 4hour candle as well. When i drew my yellow box on the 1min, i kind of rushed it. the goal was just to convey the high came before the low and i didn't accurately represent all the data covered by the 4hour candle. That 2nd peak is also what caused the green candle on the 4hour, since it gave us a close above the open, which is what i want to ignore in the candle coloring condition.

Thank you very much for your detailed answer, i didn't have much hope for it being possible, but figured i'd ask anyway. I will try to implement your suggested work around, appreciate your time.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
332 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