MetaTrader5
Mastering Pin Bars: The Essential Indicator for MetaTrader 5 Traders
What is a Pin Bar?
A Pin Bar is a specific type of candlestick that features a small body and an elongated shadow. This configuration often signals a potential price reversal, making it a key pattern for traders to watch.
The Pin Bar indicator scans your chart for these Price Action patterns and marks them with icons, making it easier to identify trading opportunities:
To avoid cluttering your chart with false signals, the indicator looks for patterns on past bars. When it identifies a Pin Bar, it places a signal arrow on the current bar, right at its opening price. This indicator adheres strictly to the formation rules of Pin Bars, so it's recommended to pair it with another indicator for filtering and confirmation, such as one that highlights key support and resistance levels.
Customizing Your Pin Bar Indicator
The Pin Bar indicator comes with four adjustable parameters:
Minimum Size of a Candle (from low to high): This parameter sets the minimum height of a candle (in pips) that the indicator will analyze. Candles smaller than this threshold will be disregarded, helping you filter out noise in low-volatility markets. Increase this value to refine your signals.
Maximum Size of the Candle Body Relative to Its Shadows: This establishes the maximum allowable size of the candle body (the difference between Open and Close) compared to the total height of the candle. A smaller value means more pronounced signals with long shadows and small bodies—classic indicators of a Pin Bar. For clean signals, try values between 0.2 to 0.4.
Position of the Body Relative to the Previous Candle: This parameter defines how deep the Pin Bar body can penetrate into the range of the previous candle. A smaller value means the body will be closer to the edge, aligning with classic reversal patterns. Values between 0.2 and 0.4 are ideal for identifying signals where the Pin Bar body is near the previous candle’s border.
Aspect Ratio of the Shadows: This sets the minimum ratio between the length of the main shadow (upper for a Pin Bar to Sell, lower for a Pin Bar to Buy) and the opposite shadow. The higher the value, the more prominent the main shadow should be. Values between 1.5 and 2.5 help filter signals to only include candles with a clearly defined long shadow.
How the Indicator Works
It analyzes each candle on the chart and compares it with preceding ones.
It identifies candlesticks with small bodies and one shadow significantly longer than the other.
It verifies that the body of the candlestick is contained within the range of the previous candlestick, which is crucial for a classic Pin Bar.
If a candle meets all the criteria, the indicator marks it with an arrow on the chart:
Blue Arrow: Pin Bar to Buy (long lower shadow) on the previous bar (PinBar to Up - buffer 0), and a blue signal arrow on the current bar (Signal Buy - buffer 2).
Red Arrow: Pin Bar to Sell (long upper shadow) on the previous bar (PinBar to Down - buffer 1), and a red signal arrow on the current bar (Signal Sell - buffer 3).
Parameter Settings Recommendations
For More Rigorous Signal Selection:
Increase the Minimum Size of a Candle from Low to High and Aspect Ratio of the Shadows.
Decrease the Maximum Size of the Candle Body Relative to Its Shadows and Position of the Body Relative to the Previous Candle.
For Increased Signal Frequency:
Decrease the Minimum Size of a Candle from Low to High and Aspect Ratio of the Shadows.
Increase the Maximum Size of the Candle Body Relative to Its Shadows and Position of the Body Relative to the Previous Candle.
Adjust parameters based on the volatility of the instrument and timeframe to ensure the indicator finds the most relevant Pin Bars for your trading strategy.
Buffer Numbers for External Programs:
Buffer 0 (Name PinBar to Up): Marks Pin Bars for Buy.
Buffer 1 (Name PinBar to Down): Marks Pin Bars for Sell.
Buffer 2 (Name Signal Buy): Indicates a signal to buy.
Buffer 3 (Name Signal Sell): Indicates a signal to sell.
To get signals from your Expert Advisor, use Buffers 2 and 3 for Buy and Sell signals, respectively. The values in these buffers appear on the current bar and reflect its opening price, while the previous bar contains the details of the identified pattern. If Buffer 0 has a value, it indicates a Buy Pin Bar, while Buffer 1 signifies a Sell Pin Bar.
Feel free to tweak the parameters to align with your trading style and the frequency of signals you prefer, ensuring that the indicator integrates smoothly into your overall strategy.
2025.10.12