Highest hi-lowest lo of prev 1,2,3 bars)<(highest high-lowest lo of prev 4,5,6 bars

Hi, i am writing a code for a range in mt4

>>if (high-low for current bar)<(high-low for previous bar)

if(High[0] - Low[0] < High[1] - Low[1])

but how to write this one!!

>>if(highest high-lowest low of previous 1,2,3 bars)<(highest high-lowest low of prev 4,5,6 bars)

anybody help me!!

Possibly a looping function to identify the HH of the last 3 bars and the LL of the last 3 bars. and of the previous 3 bars?

define a couple of vars // and initialize appropriately
var_H = 0.0
var_L = 1000000.0
var_H1 = 0.0
var_L1 = 1000000.0

for (int cnt=0, cnt < 4, cnt++)
{
if(iHigh[cnt] > var_H) var_H = iHigh[cnt]
if(iLow[cnt] < var_L) var_L = iLow[cnt]
}
for(int cnt2=3, cnt < 7, cnt++)
{
if(iHigh[cnt] > var_H1) var_H1 = iHigh[cnt]
if(iLow[cnt] < var_L1) var_L1 = iLow[cnt]
}

the likely
if(var_H - var_L) < (var_H1 - var_L1) you might have it.

I’m not an expert - but this is how I see it.

ah! thanks you for your reply. will study this looping function.
any other easy ways welcome:)