ThinkOrSwim 52-week Highs/Lows Scanner and Watchlist Column

X

XeoNoX

Member
you almost had it right, you need to add a negative for the percent value. here is the correct code for scanning for the LOWEST (period) low, in this case this example below scans for stocks within 10% of the 252 day (52 week) low

Code:
##Percent Away From Low by XeoNoX via https://usethinkscript.com/
##  Change Percent_value to desired percent
##  Example -3.0 means 3%   -1.5 means 1.5% away from the (number_of_day/period) low
##  NOTE: 252 is standard agregration for days in a regular trading year according to thinkscript
##  If you want 6 Months change the "PERIOD" to 126 and for a month change to 30, Week change to 7.
##  Be sure to set the Agregation to Day
##
def Percent_value = -10;
def number_of_days = 252;

def price = close;
def choice = High;
def hi = high;
def lo = low;
plot scan = price <= lowest(lo,number_of_days )* ((100 - percent_value) /100);
#End of Script
 
H

HighBredCloud

Well-known member
VIP
@XeoNoX Thank you for correcting this...As you can tell I am not a coder but trying as much as I can to figure things out on my own...This scan will come in very handy.
 
X

XeoNoX

Member
Thank you for correcting this...As you can tell I am not a coder but trying as much as I can to figure things out on my own...This scan will come in very handy.
Your welcome.... Keep trying and playing with it and asking questions, its how i learned, i didnt mean to learn it, it just happened as i started coming up with ideas and a bunch of trial and error and research. i still have much to learn.
 

Similar threads

Top