Hi, Jeremia!
// This function will get maximum rate for defined number of candles(count) from Index (first candle).
function maxCandle(count,Index : integer): double;
var
m : double;
i : integer;
begin
m:=History.Last(Index).High;
for i := 1 to count-1 do
m := max(m,History.Last(Index+i).High);
result := m;
end;
----------------------------------------------------------------------------------------------------------------------
// This function will get minimal rate for defined number of candles(count) from Index (first candle).
function minCandle(count,Index : integer): double;
var
m : double;
i : integer;
begin
m:=History.Last(Index).Low;
for i := 1 to count-1 do
m := min(m,History.Last(Index+i).Low);
result := m;
end;