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.
 

raghavag2004

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