OPEN-SOURCE SCRIPT
Engulfing & Pin Bar Breakout Strategy

Overview
This strategy automates a classic, powerful trading methodology based on identifying key candlestick reversal patterns and trading the subsequent price breakout. It is designed to be a complete, "set-and-go" system with built-in risk and position size management.
The core logic operates on the 1-Hour timeframe, scanning for four distinct high-probability reversal signals: two bullish and two bearish. An entry is only triggered when the market confirms the signal by breaking a key price level, aiming to capture momentum following a potential shift in market sentiment.
The Strategy Logic
The system is composed of two distinct modules: Bullish (Long) and Bearish (Short).
🐂 Bullish (Long) Setup
The script initiates a long trade based on the following strict criteria:
Signal: Identifies either a Hammer or a Bullish Engulfing pattern. These patterns often indicate that sellers are losing control and buyers are stepping in.
Confirmation: Waits for the very next candle after the signal.
Entry Trigger: A long position is automatically opened as soon as the price breaks above the high of the signal candle.
Stop Loss: Immediately set just below the low of the signal candle.
Take Profit: A fixed target is placed at a 1:5 Risk/Reward Ratio.
🐻 Bearish (Short) Setup
The script initiates a short trade based on the following strict criteria:
Signal: Identifies either a Shooting Star or a Bearish Engulfing pattern. These patterns suggest buying pressure is fading and sellers are taking over.
Confirmation: Waits for the very next candle after the signal.
Entry Trigger: A short position is automatically opened as soon as the price breaks below the low of the signal candle.
Stop Loss: Immediately set just above the high of the signal candle.
Take Profit: A fixed target is placed at a 1:4 Risk/Reward Ratio.
Key Feature: Automated Risk Management
This strategy is designed for disciplined trading. You do not need to calculate position sizes manually.
Fixed Risk: The script automatically calculates the correct position size to risk exactly 2% of your total account equity on every single trade.
Dynamic Sizing: The position size will adjust based on the distance between your entry price and your stop loss for each specific setup, ensuring a consistent risk profile.
How To Use
Apply the script to your chosen chart (e.g., BTC/USD).
Crucially, set your chart's timeframe to 1-Hour (H1). The strategy is specifically calibrated for this interval.
Navigate to the "Strategy Tester" tab below your chart to view backtest results, including net profit, win rate, and individual trades.
Disclaimer: This script is provided for educational and informational purposes only. It is not financial advice. All trading involves substantial risk, and past performance is not indicative of future results. Please use this tool responsibly and at your own risk.
This strategy automates a classic, powerful trading methodology based on identifying key candlestick reversal patterns and trading the subsequent price breakout. It is designed to be a complete, "set-and-go" system with built-in risk and position size management.
The core logic operates on the 1-Hour timeframe, scanning for four distinct high-probability reversal signals: two bullish and two bearish. An entry is only triggered when the market confirms the signal by breaking a key price level, aiming to capture momentum following a potential shift in market sentiment.
The Strategy Logic
The system is composed of two distinct modules: Bullish (Long) and Bearish (Short).
🐂 Bullish (Long) Setup
The script initiates a long trade based on the following strict criteria:
Signal: Identifies either a Hammer or a Bullish Engulfing pattern. These patterns often indicate that sellers are losing control and buyers are stepping in.
Confirmation: Waits for the very next candle after the signal.
Entry Trigger: A long position is automatically opened as soon as the price breaks above the high of the signal candle.
Stop Loss: Immediately set just below the low of the signal candle.
Take Profit: A fixed target is placed at a 1:5 Risk/Reward Ratio.
🐻 Bearish (Short) Setup
The script initiates a short trade based on the following strict criteria:
Signal: Identifies either a Shooting Star or a Bearish Engulfing pattern. These patterns suggest buying pressure is fading and sellers are taking over.
Confirmation: Waits for the very next candle after the signal.
Entry Trigger: A short position is automatically opened as soon as the price breaks below the low of the signal candle.
Stop Loss: Immediately set just above the high of the signal candle.
Take Profit: A fixed target is placed at a 1:4 Risk/Reward Ratio.
Key Feature: Automated Risk Management
This strategy is designed for disciplined trading. You do not need to calculate position sizes manually.
Fixed Risk: The script automatically calculates the correct position size to risk exactly 2% of your total account equity on every single trade.
Dynamic Sizing: The position size will adjust based on the distance between your entry price and your stop loss for each specific setup, ensuring a consistent risk profile.
How To Use
Apply the script to your chosen chart (e.g., BTC/USD).
Crucially, set your chart's timeframe to 1-Hour (H1). The strategy is specifically calibrated for this interval.
Navigate to the "Strategy Tester" tab below your chart to view backtest results, including net profit, win rate, and individual trades.
Disclaimer: This script is provided for educational and informational purposes only. It is not financial advice. All trading involves substantial risk, and past performance is not indicative of future results. Please use this tool responsibly and at your own risk.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
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.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
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.