Ok, thanks for checking. I looked over the code I posted and there were some obvious errors. Just typos for the most part. So here is my updated version. I found this description of your scan online in another forum. Your’s is leaving out the Average Volume filter. When I add that volume filter to this version for Thinkorswim I get 29 ticker symbols in the scan results. I ran the scan on a daily time frame, against All Stocks, with 50 day average volume > 500,000.
First, here is the description of your scan I found online:
MINL5 > MINL20
(the minimum low of the last five day is greater than the minimum low of the last 20 days)
AND MAXH7.1 = MAXH36
(the maximum high of the last 7 days as of 1 day ago equals the maximum high of the last 36 days)
AND MAXH3.1 < MAXH36.1
(the maximum high of the last 3 days as of 1 day ago is less than the maximum high of the last 36 days as of 1 day ago)
AND H > MAXH3.1 * 1.005
(today’s high is greater than the (high of the last three bars as of 1 day ago * 1.005))
AND AVGV50 > 5000
(the average volume of the last 50 days is greater than 500000)
And here is my revised version for Thinkorswim:
#MinL5>MinL20 And MaxH7.1=maxh36 And MaxH3.1<MaxH36.1 And H>MaxH3.1*1.005
declare lower;
def fiveBarLow = Lowest(low, 5);
def twentyBarLow = Lowest(low, 20);
def conditionOne = fiveBarLow > twentyBarLow;
def sevenBarHighExcludingCurrent = Highest(high[1], 7);
def thirtySixBarHigh = Highest(high, 36);
def conditionTwo = sevenBarHighExcludingCurrent == thirtySixBarHigh;
def threeBarHighExcludingCurrent = Highest(high[1], 3);
def thirtySixBarHighExcludingCurrent = Highest(high[1], 36);
def conditionThree = threeBarHighExcludingCurrent < thirtySixBarHighExcludingCurrent;
def conditionFour = high > threeBarHighExcludingCurrent * 1.005;
plot scan1 = conditionOne and conditionTwo and conditionThree and conditionFour;
Note: This does not include the Average Volume filter. I applied that as a separate filter criteria when creating my test scan.
Please let us know what platform that code is from. We’ll need to do some research in order to be able to port that over to Thinkorswim.
tc2000
Thanks. I’ll be away from the computer most of the day but if I get time I will see if I can find a quick solution to your request. Otherwise, any response will be delayed until late evening.
No rush. Thanks for taking the time!
Thanks