Try this - start with broad scan and then narrow yourself or scan with another scanner like we were talking about in another post-The one I’m referring to is in Scan Hacker > Add Filter > Patterns > Double Bottoms. That may not be exactly right since I’m operating from memory, but it should be pretty close to show what I mean. Thank you, as always, for your help.
input lowLookback = 40;
input tolerancePct = 3.0;
input reboundMinPct = 5.0;
input shortMA = 21;
def c = close;
def h = high;
def l = low;
def ma = ExpAverage(c, shortMA);
def priorLow = Lowest(l[10], lowLookback);
def pctFromPriorLow = 100 * (c - priorLow) / priorLow;
def nearPriorLow = AbsValue(100 * (l - priorLow) / priorLow) <= tolerancePct;
def reboundAfterLow = Highest(h, 10) >= priorLow * (1 + reboundMinPct / 100);
def structureRepair = c > ma;
plot scan = nearPriorLow and reboundAfterLow and structureRepair;
input lowLookback = 40;
input undercutPct = 2.0;
input reclaimMA = 10;
def c = close;
def l = low;
def priorLow = Lowest(l[5], lowLookback);
def undercut = l < priorLow and l >= priorLow * (1 - undercutPct / 100);
def reclaimed = c > priorLow;
def aboveShortMA = c > Average(c, reclaimMA);
plot scan = undercut and reclaimed and aboveShortMA;
input lookback1 = 30;
input lookback2 = 10;
input shortMA = 21;
input longMA = 50;
def c = close;
def l = low;
def maShort = ExpAverage(c, shortMA);
def maLong = Average(c, longMA);
def leftLow = Lowest(l[lookback2], lookback1);
def recentLow = Lowest(l, lookback2);
def higherLow = recentLow > leftLow * 1.02;
def repaired = c > maShort and maShort >= maLong * 0.98;
plot scan = higherLow and repaired;
Try this - start with broad scan and then narrow yourself or scan with another scanner like we were talking about in another post-
Code:input lowLookback = 40; input tolerancePct = 3.0; input reboundMinPct = 5.0; input shortMA = 21; def c = close; def h = high; def l = low; def ma = ExpAverage(c, shortMA); def priorLow = Lowest(l[10], lowLookback); def pctFromPriorLow = 100 * (c - priorLow) / priorLow; def nearPriorLow = AbsValue(100 * (l - priorLow) / priorLow) <= tolerancePct; def reboundAfterLow = Highest(h, 10) >= priorLow * (1 + reboundMinPct / 100); def structureRepair = c > ma; plot scan = nearPriorLow and reboundAfterLow and structureRepair;
What this is doing
It tries to avoid random falling knives by requiring:
This still may catch some sloppy names in broad ranges. That is why I’d rank them with additional columns.
- a prior low exists
- price revisits that zone
- there was at least some rebound off the first low
- price is starting to repair above short-term structure
Scan B: Undercut and reclaim
This is the stronger one.
Code:input lowLookback = 40; input undercutPct = 2.0; input reclaimMA = 10; def c = close; def l = low; def priorLow = Lowest(l[5], lowLookback); def undercut = l < priorLow and l >= priorLow * (1 - undercutPct / 100); def reclaimed = c > priorLow; def aboveShortMA = c > Average(c, reclaimMA); plot scan = undercut and reclaimed and aboveShortMA;
This captures a very tradeable pattern family:
That often matters more than finding two mathematically equal lows.
- prior low tested
- sellers pushed it marginally lower
- stock reclaimed the low
- right-side repair has begun
Scan C: Higher-low repair
This is for stronger names that do not need a full retest.
Code:input lookback1 = 30; input lookback2 = 10; input shortMA = 21; input longMA = 50; def c = close; def l = low; def maShort = ExpAverage(c, shortMA); def maLong = Average(c, longMA); def leftLow = Lowest(l[lookback2], lookback1); def recentLow = Lowest(l, lookback2); def higherLow = recentLow > leftLow * 1.02; def repaired = c > maShort and maShort >= maLong * 0.98; plot scan = higherLow and repaired;
A lot of the best swing names do not print a clean second bottom. They just stop going down, print a higher low, and repair. You want those too.
they are scans on their own but you can layer them in the scanning hacker like Merry was saying scan within a scan so to speakAre these put into an existing scan as an additional filter?
How was the Chili?mmm, I like how that would work. I'll start working with it in a while (pesky Dr. app'ts right now). Thanks so much for sharing!!!
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Start a new thread and receive assistance from our community.
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.
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.