Help with 60/40 percent of candle to show as label


Active member
Is there a way to have a label that turns green if price hits 60 percent or above the current candle, or red if 40 percent or below the current candle. i have this so far.

# germanburrito

def bound_high = high ;
def bound_low = low ;
def difference = bound_high - bound_low;
def T = difference* .4;
def L = difference* .6;
def up = bound_low + L;
def down = bound_low + T;

AddLabel(yes, Concat(" 60 UP = ", down), Color.yellow);
AddLabel(yes, Concat(" 60 Down = ", up), Color.yellow);
Last edited by a moderator:
What you are referring to is called the ATR ( Average True Range ) of the candle.
Shows the average of the true range for Current Candle and percent of range relative to the the current price (close) and allows to change label color based of percentage threshold input

In the input you can change your percentage threshold in the input as well, i set it for you values you requested. Remember to hit the like button if you found this post useful.


declare upper;
#min percentage required for green color (greater than)
input upper_threshold = 60;
#max percentage required for red color (lower than)
input lower_threshold = 40;

def range1 = high-low;
Def range2 = low -close;
def percent=  absValue(range2/range1)*100;

AddLabel(yes, "Price is " + round(percent)+ "%" + " of Current Range of " + Range1 ,if percent > upper_threshold then color.uptick else if percent < lower_threshold then color.dark_red else color.white);
Last edited:

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

i just realized the formula is off... do you have the formula ? or know of a website with the formula to get percentage of the range from the current price? if you do i can plug it in for you.
actually i sorta figuere it out, basically waht i wanted to do was inplent the strat strategy, its a cool concept to see basic price movement, but inotice that when a candle goes above or below 60 percent of the previous candle theres a much bigger chance the stock will keep goin in that direction heres the simple code i have
# germanburrito
# 60% candle direction.
def bound_high = high[1] ;
def bound_low = low[1] ;
def difference = bound_high - bound_low;
def T = difference* .4;
def L = difference* .6;
def up = bound_low + L;
def down = bound_low + T;

def U = close >= up ;
def D = close <= down;

AddLabel( U, " up 60% " , Color.Green);
AddLabel( D, " DOWN 60%" , Color.Red);

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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