Bullish/Bearish engulfing; previous bar close in top/bottom 25% of the bar behind it (MQL4)

 

Hello forum, good day.

I need help from more experienced MQL programmers to detect a Bullish/Bearish engulfing and would like to know about your opinions and what would be the best way to do it. I´m using the following code to try and detect a Bullish engulfing:

 

// Bullish engulfing
   (Close[1] > Open[1])
&& (Close[1] > Close[2] && Close[1] > Open[2])
&& (Open[1] < Open[2] && Open[1] < Close[2])
&& (lowest_low_1 < lowest_low_2 && highest_high_1 > highest_high_2)


I´m also trying to know if the previous bar closes in the top/bottom 25% of the bar behind the previous one, this is what I´m using:

 

// Top 25%
Close[1] >= ( ( High[2] + Low[2] ) / 4 ) * 3

// Bottom 25%
Close[1] <= ( High[2] + Low[2] ) / 4


Your help will be much appreciated. 

 

Best regards and thank you in advance,

codeMolecules 

Reason: