Script not working as expected

shahgols

New member
Hi all, I am trying to get the list of all stocks that went up 10% at some point during the day. That's 10% from the price at which the stock started trading today. I wrote this script and while all the results are correct, I noticed that it missed a few other stocks. For example, it missed KAVL and YTEN. Can you please take a look and let me know what I am doing wrong, because I can't find it. Thank you!

Code:
def na = double.nan;
def agg = AggregationPeriod.DAY; 
def OpenLine = open(period = agg);

def High = Highest(high(period = AggregationPeriod.DAY)[0], 1);

plot X = if OpenLine * 1.1 < High
then
1
else na;
 
Solution
@shahgols
I did a scan with this and it picked up KAVL and YTEN.
Ruby:
input sPeriod = {default DAY};

def varhigh = high(period = sPeriod);
def varopen = open(period = sPeriod);

plot X = if varopen * 1.1 < varhigh then 1 else Double.NaN;

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

Thank you very much Svanoy. It works! And I will be using it to just review stocks that have gone up more than 10% at some point during the day, to see how they perform after going up so much.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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