The starting point: a pinbar indicator
The original indicator was fairly simple. It looked at the candle body, the upper and lower shadows, and the previous candle to decide whether to mark a bullish or bearish pinbar.
A bullish pinbar has a relatively long lower shadow. A bearish pinbar has a relatively long upper shadow. The supplied rules also compare the current candle’s body with the previous candle’s body, so not every candle with a wick gets a label.
The chart already displayed BULLISH PINBAR and BEARISH PINBAR markers. What it didn't have was a TradingView alert condition you could select when creating a notification.
First improvement: alerts for pinbars
That first change was to add alerts without changing the basic pinbar detection. Instead of watching the chart for a triangle to appear, the indicator could notify you when its pinbar condition was met.
There was also a timing detail to work through. A close-confirmed pinbar only fires after the candle has finished. A real-time pinbar alert can fire while the candle is still forming, which is useful for earlier notifications but means the signal can change before the close.
The later requirement was different: combine the pinbar with another candlestick pattern and alert only once the complete sequence was confirmed.
The next requirement: Pinbar followed by a 3 Line Strike
The new request was specific. A pinbar must appear first, and the very next candle must complete a qualifying 3 Line Strike signal. There should be no unrelated candle in between.
The supplied 3 Line Strike logic looks for three preceding candles in the same direction, followed by an opposite-colour candle with a larger body than the immediately preceding candle. The combined alert then also requires the previous candle to satisfy the pinbar rules.
That last condition matters: this is a specific combination of the supplied Pinbar and 3LS rules, not an alert for every possible textbook variation of either pattern.
What changed in the combined version?
I brought both sets of conditions into one Pine Script v6 indicator. The final script checks the pinbar on the previous candle, checks the 3LS signal on the current candle, and triggers only when both conditions line up and the current candle has closed.
- Next-candle sequence: the pinbar must be immediately before the completing 3LS candle.
- Close-confirmed alerts: combined alerts do not trigger while the final candle is still forming.
- Three alert choices: bullish combination, bearish combination, or either direction.
- Cleaner chart markers: combo labels are placed below the candles using an ATR-based offset.
- Separate from existing alerts: the combined signal is its own indicator, so existing standalone pinbar and 3LS alerts can remain as they are.
Why wait for the candle to close?
A pinbar can form partway through a candle and disappear before the candle closes. For this combined indicator, the request was to wait for the completed 3LS candle instead of sending an early notification that might no longer match the pattern.
The code uses Pine Script's confirmed-bar check for that. This makes the combined condition suitable for a Once Per Bar Close TradingView alert.
Available TradingView alerts
In the completed script, the alert menu offers three conditions:
| Alert condition | When it triggers |
|---|---|
| Bullish Pinbar + 3LS | The bullish combination is confirmed at candle close. |
| Bearish Pinbar + 3LS | The bearish combination is confirmed at candle close. |
| Any Pinbar + 3LS | Either confirmed combination is detected. |
The finished Pinbar + 3LS indicator
The result is a focused TradingView indicator that watches for a particular two-part candlestick sequence and makes it available as a selectable alert. It keeps the original pinbar and 3LS rules together, with no need to keep checking the chart manually for the combination.
The downloadable version is written in Pine Script v6 and retains the candle-close confirmation and separate alert conditions.
Download the full script for free
Download the complete Goat Trap Pinbar + 3LS Combo indicator.
Download free Pine Script ↓Having issues with installation, chart configuration, or anything else related to the script? Feel free to contact me.