Engulfing
Download scriptThis visual tool is designed to assist traders by automatically identifying specific price action patterns on a trading chart. Rather than relying on complex mathematical formulas or lagging averages, it scans the historical price movement to pinpoint "Engulfing" candles—a classic technical analysis pattern where one candle's body completely overlaps and overcomes the previous one.
How the Logic Works
The script continuously monitors the relationship between two consecutive candles on your chart. It looks for moments of significant momentum shift by evaluating four specific criteria:
1. Identifying Bullish Momentum (Upward Signals) The tool searches for a situation where a large "green" (bullish) candle appears immediately after a "red" (bearish) candle. To trigger a signal, the script verifies that:
- The current candle closed higher than it opened.
- The previous candle closed lower than it opened.
- The body of the current candle is large enough to completely cover the body of the previous candle.
When these conditions are met simultaneously, the script places an upward-pointing arrow on the chart to highlight a potential shift toward buying pressure.
2. Identifying Bearish Momentum (Downward Signals) Conversely, the tool looks for "bearish engulfing" patterns to identify selling pressure. It flags a signal when:
- The current candle closed lower than it opened.
- The previous candle closed higher than it opened.
- The body of the current candle is large enough to completely envelop the body of the previous candle.
When this occurs, the script places a downward-pointing arrow to indicate a potential shift toward selling pressure.
Visual Representation
The indicator simplifies your technical analysis by filtering out the "noise" of the market. Instead of manually checking every candle for these overlaps, the tool automatically plots high-visibility arrows (colored in Aqua and Violet) directly on your chart. This allows you to quickly identify zones where the trend might be reversing or where new momentum is entering the market.
//+------------------------------------------------------------------+
#property copyright "ë¸êñóñ"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Aqua
#property indicator_color2 Violet
double Up[],Dn[];
//+------------------------------------------------------------------+
int init()
{
SetIndexBuffer(0,Up);
SetIndexBuffer(1,Dn);
SetIndexStyle(0,DRAW_ARROW);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(0,233);
SetIndexArrow(1,234);
return(0);
}
//+------------------------------------------------------------------+
int start()
{
int i,CountBars=Bars-1;
for(i=0; i<CountBars; i++)
{
Up[i]=0.0; Dn[i]=0.0;
if(Close[i+1]>Open[i+1] && Close[i+2]<Open[i+2] && Close[i+1]>Open[i+2] && Open[i+1]<=Close[i+2]) { Up[i]= Low[i+2]; }
if(Close[i+1]<Open[i+1] && Close[i+2]>Open[i+2] && Close[i+1]<Open[i+2] && Open[i+1]>=Close[i+2]) { Dn[i]=High[i+2]; }
}
return(0);
}
//+------------------------------------------------------------------+
int deinit() { return(0); }
//+------------------------------------------------------------------+
Comments