# Percent From Daily Open For ThinkOrSwim

#### JamesB

##### Member
How would you create a percent change label for a different symbol such as SPY that would track the change since the market open? Thus, it would not include the percent change from the previous day, just from the open.

Solution
How would you create a percent change label for a different symbol such as SPY that would track the change since the market open? Thus, it would not include the percent change from the previous day, just from the open.
Try this
Ruby:
``````def o = if SecondsFromTime(0930) == 0 and SecondsTillTime(0930) == 0 then open else o[1];
def PercentChg = 100 * (close / o - 1);
AddLabel(1, " Percent Chg from open: " + close + " / " + o + " = " + PercentChg + "%", if close > o then Color.GREEN else Color.RED);``````
How would you create a percent change label for a different symbol such as SPY that would track the change since the market open? Thus, it would not include the percent change from the previous day, just from the open.
Try this
Ruby:
``````def o = if SecondsFromTime(0930) == 0 and SecondsTillTime(0930) == 0 then open else o[1];
def PercentChg = 100 * (close / o - 1);
AddLabel(1, " Percent Chg from open: " + close + " / " + o + " = " + PercentChg + "%", if close > o then Color.GREEN else Color.RED);``````

Perfect and you could tell us how to put it on the watchlist, thank you very much, sorry my English

Perfect and you could tell us how to put it on the watchlist, thank you very much, sorry my English
Put this in a custom column editor. I have set the percentage change to absolute value and rounded, as the background color of green/red will indicate whether it is positive/negative.

The picture shows from left to right, the colored custom column, the custom column 13 in the watchlist editor, and the code in the custom 13 formula.

Ruby:
``````def o = if SecondsFromTime(0930) == 0 and SecondsTillTime(0930) == 0 then open else o[1];
def PercentChg = 100 * (close / o - 1);
assignbackgroundColor(if close > o then Color.GREEN else Color.RED);``````

As said is there any way to create a script that scans for stocks above or x percent near the open (on the daily)

As said is there any way to create a script that scans for stocks above or x percent near the open (on the daily)
Ruby:
``````input x = 98 ;
def o = if SecondsFromTime(0930) == 0 and SecondsTillTime(0930) == 0 then open else o[1];
def PercentChg = 100 * (close / o - 1);
plot scan = PercentChg > x ;``````

Hi,
maybe someone can help me since i am not ut in writing scruipt. I would like to know how far the current price is from the DailyOpen in percent. Similar to my picture where I see how far the short is from the EMA.

Hi,
maybe someone can help me since i am not ut in writing scruipt. I would like to know how far the current price is from the DailyOpen in percent. Similar to my picture where I see how far the short is from the EMA.

try this code in a watchlist.

Code:
``````def o = if SecondsFromTime(0930) == 0 and SecondsTillTime(0930) == 0 then open else o[1];
plot PercentChg = round(100 * (close / o - 1),1);``````

i changed this,
to display a % number.

Thanks ! Works great

87k+ Posts
281 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?