PROTECTED SOURCE SCRIPT

Base Detector Pro [AletheiaTradeLab]

73
This custom Trading View indicator combines William O’Neal “Base” patterns with several complementary tools—David Ryan’s ANT indicator, key pivot‐based price levels, index and earnings lines, relative strength (RS) line, and moving averages—to help you pinpoint base formations and validate whether each one merits a trade.

1. Bases (William O'Neal)

A “base” is simply a period of price consolidation following a significant run-up. During this phase, a stock moves mostly sideways within a defined trading range, forming clear support and resistance lines.

Key Criteria for a Valid Base
- Prior Uptrend
Before a base begins, the stock should already have a healthy advance—typically at least a 30% gain.

- Shapes of Bases
Bases can form in several distinct geometric patterns, each signaling a different kind of consolidation and potential breakout:

Flat Base

Shape: A horizontal rectangle bounded by nearly parallel support (bottom) and resistance (top) trendlines.
Minimum Length: 5 weeks
Maximum Length: 65 weeks
Depth: < 15%
Pivot Point: Left-side high of base

i.ibb.co/JW6rCVn9/flat-daily.png i.ibb.co/chS6K9yL/flat-weekly.png

Cup Base

Shape: A smooth, rounded “U” curve.
Minimum Length: 6 weeks
Maximum Length: 65 weeks
Minimum Depth: 8%
Maximum Depth: 50%
Pivot Point: Left-side high of base

i.ibb.co/Y7bmVSMV/cup-daily.png i.ibb.co/Xf8ZwmwH/cup-weekly.png

Sauce Base

Shape: A very gradual, broad “U” curve, often taking more length than cup bases.
Minimum Length: 6 weeks
Maximum Length: 65 weeks
Minimum Depth: 8%
Maximum Depth: 50%
Pivot Point: Left-side high of base

i.ibb.co/p60TMjy1/saucer.png i.ibb.co/BH7tkRxz/saucer-weekly.png

Cup with Handle Base

Shape: A “U”‐shaped cup followed by a smaller downward-sloping flag or channel (the handle).
Minimum Length: 6 weeks
Maximum Length: 65 weeks
Minimum Depth: 8%
Maximum Depth: 50%
Pivot Point: High of the handle

i.ibb.co/BVLj9CgW/cup-with-handle-daily.png i.ibb.co/vvRNQbqg/cup-with-handle-weekly.png

Saucer with Handle Base

Shape: Similar to cup with handle, but cup looks like the saucer base.
Minimum Length: 6 weeks
Maximum Length: 65 weeks
Minimum Depth: 8%
Maximum Depth: 50%
Pivot Point: High of the handle

i.ibb.co/KpcQDcjn/saucer-with-handle-weekly.png

Ascending Base

Shape: An upward-sloping channel or wedge with 3 pullbacks. Each pullback low should be higher than the previous one. It needs around 20% increase from a base to the other.
Minimum Length: 8 weeks
Maximum Length: 16 weeks
Minimum Depth: 8%
Maximum Depth: 50%
Pivot Point: Left-side high of third base

i.ibb.co/YBHCJ6V7/ascending-daily.png i.ibb.co/LDVq3T5Z/ascending-weekly.png

Consolidation Base

Shape: Similar to flat base, but wider and fails to form any of the above bases.
Minimum Length: 8 weeks
Maximum Length: 16 weeks
Minimum Depth: 8%
Maximum Depth: 50%
Pivot Point: Left-side high of base

i.ibb.co/nNvVcrB9/consolidation-daily.png i.ibb.co/SDgSFWwP/consolidation-weekly.png

- Base Stages
Once a stock has completed its initial 30% run-up and formed its first base, that pattern is labeled Stage 1.

After a breakout from Stage N, the stock must rally at least 20% above the Stage N pivot (the base’s resistance point). If it does, the next valid base becomes Stage N + 1.

When a breakout fails to advance at least 20% a base on base forms. This is considered an extension for the current base stage, and a letter is assigned after the stage number.

When a breakout fails and the price undercuts the low for the previous base, the base stages reset, and a rally of 30% will be needed to form a new stage 1 base.

Note that for IPO stocks, a 30% increase is not required to form the first base. As soon as it meets any of the shape of any of the available bases, it will be drawn.

- Base statistics
To help you determine how healthy is a base, some statistics are available when you hover on the small dot shown above the high-left side of each base.
i.ibb.co/ksS4rNwn/base-statistics.png

Base: The specific pattern type (Flat, Cup, Sauce, etc.).
Stage: The stage number of the base (1, 2, 3 …) and, in parentheses, how many distinct bases have formed since the very first base (including base-on-base like 1a, 1b, etc.).
Pivot: The resistance level that defines the top of the base. A close above this price often signals a valid breakout and a potential entry point.
Length: The number of bars (days on a daily chart; weeks on a weekly chart) between the start of the base and the bar immediately before breakout. (The initial bar and the breakout bar themselves are not counted.)
Depth: How far, in percentage terms, the low of the base has fallen below its left-side high.
Prior Uptrend: The percent gain from the pivot of the previous base up to the start of the current base.
Blue/Red Count: The number of up days (Blue) and down days (Red) during the base where volume was above the 50-period moving average.
Price %: The percent change from the close at the end of the base to the close at the breakout bar.
Volume %: The percent difference between the volume on the breakout bar and the 50-period average volume at the end of the base.

2. ANT Indicator (David Ryan)
The ANT indicator, developed by David Ryan, is a momentum-based signal used to identify high-potential breakout candidates during a stock’s run-up phase. It complements the base patterns by flagging moments of unusually strong price and volume activity within an uptrend, helping confirm emerging strength before or during a base formation.
i.ibb.co/6cRKBhB0/ants.png

3. Key Price Levels (Pivots)
Plots recent pivot-based support and resistance levels.

i.ibb.co/KcRmkVsw/key-price-levels.png

4. Index Line Overlay
Overlays a chosen index (e.g. SPX) on the top portion of the chart to compare relative performance.

i.ibb.co/Fk6xp1Jn/index-line.png

5. Relative Strength (RS) Line
Plots the price ratio of the symbol vs. an index (e.g. SPX) to identify outperformance.

i.ibb.co/r27bhTTF/rs-line.png

6. Moving Averages (SMA & RS-MA)
Allows up to four simple (or exponential) moving averages on price (daily/weekly) and three on the RS line.

7. Earnings Line & EPS Change
Marks earnings events on daily/weekly charts and optionally plots YoY EPS change in a lower portion of the chart. The earnings line also shows a projection to estimated earnings. To maintain alignment with the price chart, the line and YoY EPS data are limited to the most recent 28 quarters on weekly charts and 8 quarters on daily charts. For analyzing older data, you can use the replay feature.

i.ibb.co/HDFggyS0/earnings.png

8. Bars
Since Trading View displays very thin bars when zoomed out, I added 2-pixel-wide vertical lines over the bars to make them easier to see.

9. Dark Theme
I added this for a quick workaround to adapt colors for dark theme. Enabling this overrides any custom settings. Uncheck to customize colors.

i.ibb.co/mCYmKRN6/dark-theme.png

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.