Bar closes on the top/bottom 25% of its range

 

Hello forum, good day.

How could I know in MQL4 if a bar closes on the top or bottom 25% of its range? Your help will be much appreciated.

 

Best regards and thank you in advance,

Gerardo 

 
Gerardo Bustos:

Hello forum, good day.

How could I know in MQL4 if a bar closes on the top or bottom 25% of its range? Your help will be much appreciated.

 

Best regards and thank you in advance,

Gerardo 

I will try to use the following and see if it works:

 

Top 25%

double BarRange = High[shift] - Low[shift];

if ( Close[shift] >= High[shift] - ( BarRange * 0.25 ) ) return( true );

 

Bottom 25% 

double BarRange = High[shift] - Low[shift];

if ( Close[shift] <= Low[shift] + ( BarRange * 0.25 ) ) return( true );

 

Best regards and thank you,

Gerardo 

Reason: