Trying to get script to accurately filter stocks that rise e.g. 2% in volume and price for 3 consecutive weeks

TOSnewb

New member
Hi guys, I got a script but it is not exactly working to the tee as I figured there are some tickers that it did not pick up like SBUX where it had 3 rising weeks of both volume and price even though I set the % parameters to 0.5% from initial 2%
My script is as below, can someone enlighten me how could I modify it to pick up tickers accurately?

input price = close;
input length = 3;
input vol = volume;

def twoPercentGainPrice = 100 * (price / price[1] - 1) >= 2.0;
def threeBarsOfGainPrice = twoPercentGainPrice[2] and twoPercentGainPrice[1] and twoPercentGainPrice;

def twoPercentGainVol = 100 * (vol / vol[1] - 1) >= 2.0;
def threeBarsOfGainVol = twoPercentGainVol[2] and twoPercentGainVol[1] and twoPercentGainVol;

plot scan = threeBarsOfGainPrice and threeBarsofGainVol;
 

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

I am debugging it as an indicator. Can you point to a specific date and ticker when you are getting incorrect results?
Sorry not sure what do you mean, if you meant when did I get incorrect result that'd be everyday and SBUX is the ticker that I found by accident that it should show up in scanner.
 
OK. Well, you might want to check your formulas for the vol and price % gain, but also you are forgetting that the week of Jul 2 also comes into play. Your formula says 7/23 > 7/16 and 7/16 > 7/9 and 7/9 > 7/2. - Matt.
 
OK. Well, you might want to check your formulas for the vol and price % gain, but also you are forgetting that the week of Jul 2 also comes into play. Your formula says 7/23 > 7/16 and 7/16 > 7/9 and 7/9 > 7/2. - Matt.
Hmm okay thanks for your input! Not really fluent at programming and also this script was given by someone as well and thought it worked fine at the start but realised it isn't capturing the entirety and how I'd want it to work.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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