How to set a min and max % price move over a moving average in ToS Scanner?

Ciaranmci27

New member
Im new to making scanners with ToS so this might be a lot more simple then i expect but i really appreciate any help i can get!
I have made almost my ideal options scanner but the only thing i cant figure out is how to set a maximum % price move over the 8 EMA. I would like it to scan for a minimum of a 1% price move over the 8 EMA and a maximum of a 5% price move over the 8 EMA, how would i implement that? The scanner currently just shows me all stocks that crossed a minimum of 1% over the 8 EMA and im not sure how to cap it at 5% maximum. Thanks a ton!
 
Solution
Im new to making scanners with ToS so this might be a lot more simple then i expect but i really appreciate any help i can get!
I have made almost my ideal options scanner but the only thing i cant figure out is how to set a maximum % price move over the 8 EMA. I would like it to scan for a minimum of a 1% price move over the 8 EMA and a maximum of a 5% price move over the 8 EMA, how would i implement that? The scanner currently just shows me all stocks that crossed a minimum of 1% over the 8 EMA and im not sure how to cap it at 5% maximum. Thanks a ton!

i think this code will work to find what you want

Code:
# true if close is between 1% and 5% above ema8
#
# enable this line to test as a lower chart study
# declare lower;
#...

jmoney

New member
I believe you could use the "None of the following" condition filter and add a condition that says the price moves 5% over the 8EMA, just like how you set the 1% minimum for the condition you want it to follow. Hope this helps and makes sense.
 

venkym

New member
VIP
Im new to making scanners with ToS so this might be a lot more simple then i expect but i really appreciate any help i can get!
I have made almost my ideal options scanner but the only thing i cant figure out is how to set a maximum % price move over the 8 EMA. I would like it to scan for a minimum of a 1% price move over the 8 EMA and a maximum of a 5% price move over the 8 EMA, how would i implement that? The scanner currently just shows me all stocks that crossed a minimum of 1% over the 8 EMA and im not sure how to cap it at 5% maximum. Thanks a ton!
Its really nice idea what is the option / script to use to define that either in scanner or chart? can some one share it?
 

halcyonguy

Well-known member
VIP
Lifetime
Im new to making scanners with ToS so this might be a lot more simple then i expect but i really appreciate any help i can get!
I have made almost my ideal options scanner but the only thing i cant figure out is how to set a maximum % price move over the 8 EMA. I would like it to scan for a minimum of a 1% price move over the 8 EMA and a maximum of a 5% price move over the 8 EMA, how would i implement that? The scanner currently just shows me all stocks that crossed a minimum of 1% over the 8 EMA and im not sure how to cap it at 5% maximum. Thanks a ton!

i think this code will work to find what you want

Code:
# true if close is between 1% and 5% above ema8
#
# enable this line to test as a lower chart study
# declare lower;
#
def len = 8;
input avg_type = AverageType.EXPONENTIAL;
def avg1 = MovingAverage(avg_type, close, len); 
def avgper = round( (absvalue(close - avg1)/close)*100,1);
def minper = 1;
def maxper = 5;
plot z = ( avgper >= minper and avgper <= maxper);
 
Solution

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.
Top