A Pinbar (Pin Bar Signal) is a key reversal pattern derived from price action theory, representing a significant fluctuation in market sentiment through a single candlestick. The core logic of the Pinbar is based on the market’s behavior of “rejecting price levels”: within a certain time window, regardless of whether buyers or sellers dominate, the market ultimately rejects the extreme direction, attempting to find a “balance price.” This signal holds high value near trend reversals and key resistance and support levels.
From the perspective of quantitative analysis, a Pinbar is a pattern recognition signal that can be precisely quantified. Its calculation logic includes the following parts:
Long Shadow: The length of the shadow must be significantly greater than the length of the body (such as 2 times or more).
The position of the entity part: the entity needs to be close to one end of the shadow line, reflecting the reversal force of the market within a short period.
Price Touching Range: The background of a Pinbar is usually accompanied by important price structures, such as moving averages, Fibonacci retracement levels, or previous key highs and lows.
For example, with a “bullish Pinbar”, when the market tests lower price levels (such as support areas) and a long lower shadow appears, it indicates that the sellers’ attempt to break through has failed and the buyers are in control; while a “bearish Pinbar” appears near resistance levels, representing that the buyers’ upward momentum is being suppressed.
Core features
As a typical price action signal, a pinbar has the following structural characteristics:
Long shadow length: The shadow length is generally more than twice the length of the body part.
The physical part’s position is special: it is located at one end of the shadow, representing a concentrated expression of reversal sentiment.
Trading Logic: The shadows represent that the price level is strongly rejected in a certain direction, usually indicating the importance of support or resistance areas.
The correlation with quantitative analysis
The Pinbar, combined with key market levels (such as moving averages, Fibonacci retracements, support and resistance levels), can significantly enhance the accuracy of determining trend reversals.
In quantitative models, the pinbar can serve as a parameterized signal, which can be further optimized by combining it with trend indicators (such as MACD, RSI) or volatility indicators (such as ATR).
Mathematical Modeling Analysis
The Pinbar can also be described using mathematical modeling methods, for example:
Upper shadow length: (high − max(open, close))
Lower shadow length: (min(open, close) − low)
Entity length: |open − close|
Signal judgment condition: Assume that the shadow length ≥ body length * 2 and the K-line closing price is close to one end of the shadow, then the pattern is established.
Pinbar Trading Strategy · Inserting Needle Signal Direction
In the design of this strategy, the Pinbar Signal is the core trigger of the trend reversal logic, and the confirmation of the signal direction is closely linked to the execution strategy. The strategy logic is precise, efficient, and follows a causal relationship, capturing the maximum market opportunities with minimal form inputs.
The core idea of the Pinbar strategy can be seen as “discovering the turning point direction of the market through a pin bar”:
If the market spikes upward (with a long upper shadow), it indicates that there is significant resistance above, and the price is likely to move downward. At this point, sell your long positions and start shorting.
If the market dips down sharply (with a long lower shadow), it indicates strong support below, and the price is very likely to rebound upwards. At this point, close out short positions and start buying long.
It acts like a “market probe,” helping us to detect potential directional changes in advance. Importantly, this signal is based on strict conditions and, when combined with trend direction and support/resistance levels, can greatly improve accuracy.
A Pinbar is a unique candlestick pattern characterized by a long shadow and a short body, resembling the market “testing a price point” at a certain level. When this pin appears in key price areas, such as support or resistance levels, it often suggests that the market is attempting a reversal after testing, helping us determine the direction of the trend.
If the shadow line appears below (long lower shadow): the market is strongly supported, and the possibility of a price rebound upwards is high, which is a typical bullish signal;
If the shadow line appears above (long upper shadow): the market is under strong resistance, and the possibility of a price decline is high, which is a typical bearish signal.
The Pinbar can be understood as a market “probe” that reflects the behavior of rejecting extreme price levels and tending towards equilibrium during price fluctuations. In simple terms, this specific candlestick pattern can capture the market’s directional choice at critical moments, providing clear guidance for trading decisions. However, it is worth noting that relying solely on Pinbar signals may pose certain risks; we recommend combining it with other indicators (such as trend, momentum, or volatility indicators) to enhance the accuracy and stability of the signals, thereby improving the effectiveness of the strategy.
Join our community, let’s discuss together and become stronger!
Official Telegram community:
AiCoin Chinese https://
Group Chat - Wealth Group:
View Original
This page may contain third-party content, which is provided for information purposes only (not representations/warranties) and should not be considered as an endorsement of its views by Gate, nor as financial or professional advice. See Disclaimer for details.
Custom Indicators · Pinbar Strategy · Long Wick Candle Signal
Definition and Theoretical Background
A Pinbar (Pin Bar Signal) is a key reversal pattern derived from price action theory, representing a significant fluctuation in market sentiment through a single candlestick. The core logic of the Pinbar is based on the market’s behavior of “rejecting price levels”: within a certain time window, regardless of whether buyers or sellers dominate, the market ultimately rejects the extreme direction, attempting to find a “balance price.” This signal holds high value near trend reversals and key resistance and support levels.
From the perspective of quantitative analysis, a Pinbar is a pattern recognition signal that can be precisely quantified. Its calculation logic includes the following parts:
Long Shadow: The length of the shadow must be significantly greater than the length of the body (such as 2 times or more).
The position of the entity part: the entity needs to be close to one end of the shadow line, reflecting the reversal force of the market within a short period.
Price Touching Range: The background of a Pinbar is usually accompanied by important price structures, such as moving averages, Fibonacci retracement levels, or previous key highs and lows.
For example, with a “bullish Pinbar”, when the market tests lower price levels (such as support areas) and a long lower shadow appears, it indicates that the sellers’ attempt to break through has failed and the buyers are in control; while a “bearish Pinbar” appears near resistance levels, representing that the buyers’ upward momentum is being suppressed.
Core features
As a typical price action signal, a pinbar has the following structural characteristics:
Long shadow length: The shadow length is generally more than twice the length of the body part.
The physical part’s position is special: it is located at one end of the shadow, representing a concentrated expression of reversal sentiment.
Trading Logic: The shadows represent that the price level is strongly rejected in a certain direction, usually indicating the importance of support or resistance areas.
The correlation with quantitative analysis
The Pinbar, combined with key market levels (such as moving averages, Fibonacci retracements, support and resistance levels), can significantly enhance the accuracy of determining trend reversals.
In quantitative models, the pinbar can serve as a parameterized signal, which can be further optimized by combining it with trend indicators (such as MACD, RSI) or volatility indicators (such as ATR).
Mathematical Modeling Analysis
The Pinbar can also be described using mathematical modeling methods, for example:
Upper shadow length: (high − max(open, close))
Lower shadow length: (min(open, close) − low)
Entity length: |open − close|
Signal judgment condition: Assume that the shadow length ≥ body length * 2 and the K-line closing price is close to one end of the shadow, then the pattern is established.
In the design of this strategy, the Pinbar Signal is the core trigger of the trend reversal logic, and the confirmation of the signal direction is closely linked to the execution strategy. The strategy logic is precise, efficient, and follows a causal relationship, capturing the maximum market opportunities with minimal form inputs.
The core idea of the Pinbar strategy can be seen as “discovering the turning point direction of the market through a pin bar”:
If the market spikes upward (with a long upper shadow), it indicates that there is significant resistance above, and the price is likely to move downward. At this point, sell your long positions and start shorting.
If the market dips down sharply (with a long lower shadow), it indicates strong support below, and the price is very likely to rebound upwards. At this point, close out short positions and start buying long.
It acts like a “market probe,” helping us to detect potential directional changes in advance. Importantly, this signal is based on strict conditions and, when combined with trend direction and support/resistance levels, can greatly improve accuracy.
Chart OKX-ETHUSDT perpetual contract 5-minute interval
Chart OKX-BTCUSDT perpetual contract 3-minute interval
Chart OKX-ETHUSDT Perpetual Contract 1 Minute Interval
Backtesting Highlights: Win Rate 72.73%, Maximum Drawdown: 0.95%
Chart OKX-BTCUSDT perpetual contract 3-minute period
Backtest Highlights: Win Rate 68.42%, Maximum Drawdown: 0.47%
//@version=2
// Amplitude threshold
amplLimit=0.003
// Threshold of the entity
solidLimit=0
// Limitations of Shadows
shadowPctLimit=0.002
// Calculate upper shadow
overshadow = high - max(open, close)
// Calculate the candlestick body
solid = abs(close - open)
// Calculate lower shadow
undershadow = min(close, open) - low
// Calculate amplitude
ampl = (high - low) / close[1]
// Calculate the upper shadow price change rate
overshadowPct = overshadow / max(open, close)
// Calculate the change in the lower shadow
undershadowPct = undershadow / min(close, open)
// Pin insertion judgment algorithm
pinbar = 0
if (ampl > amplLimit) {
if (solid > solidLimit && undershadowPct > shadowPctLimit && overshadowPct > shadowPctLimit) {
pinbar := 4
}
else if (solid >= solidLimit && undershadowPct > shadowPctLimit) {
pinbar := -1
} else if (solid >= solidLimit && overshadowPct > shadowPctLimit) {
pinbar := 1
}
}
// 1 is the top pin
// -1 is a downward pin
// 4 Up and down insert pins
up = ( pinbar == 1 and close < open ) or ( pinbar [1] == 1 and close < open )
down = (pinbar == -1 and close > open) or (pinbar[1] == -1 and close > open)
// up = pinbar == 1
// down = pinbar == -1
// Create the corresponding alert conditions for use in the alert addition window.
alertcondition(up, title=‘Upper Pin Bar’, direction=“sell”)
alertcondition(down, title=‘Down Pin’, direction=“buy”)
// Draw to chart
// plot(close, title=“Close”)
plotShape(up, title=“Pin Up”, shape=‘arrowDown’, color=‘red’, refSeries=high, placement=‘top’, fill=true)
plotShape(down, title=“Down Pin”, shape=‘arrowUp’, color=‘green’, refSeries=low, placement=‘bottom’, fill=true)
// Short sell long
exitShort(down, price=‘market’, amount=1)
enterLong(down, price=‘market’, amount=1)
// Open multiple short positions
exitLong(up, price=‘market’, amount=1)
enterShort(up, price=‘market’, amount=1)
A Pinbar is a unique candlestick pattern characterized by a long shadow and a short body, resembling the market “testing a price point” at a certain level. When this pin appears in key price areas, such as support or resistance levels, it often suggests that the market is attempting a reversal after testing, helping us determine the direction of the trend.
If the shadow line appears below (long lower shadow): the market is strongly supported, and the possibility of a price rebound upwards is high, which is a typical bullish signal;
If the shadow line appears above (long upper shadow): the market is under strong resistance, and the possibility of a price decline is high, which is a typical bearish signal.
The Pinbar can be understood as a market “probe” that reflects the behavior of rejecting extreme price levels and tending towards equilibrium during price fluctuations. In simple terms, this specific candlestick pattern can capture the market’s directional choice at critical moments, providing clear guidance for trading decisions. However, it is worth noting that relying solely on Pinbar signals may pose certain risks; we recommend combining it with other indicators (such as trend, momentum, or volatility indicators) to enhance the accuracy and stability of the signals, thereby improving the effectiveness of the strategy.
Join our community, let’s discuss together and become stronger!
Official Telegram community:
AiCoin Chinese https://
Group Chat - Wealth Group: