+1 888 340 6572

HighestTimeAgo

Article/Author: Emmanuel Lavelanet for Omega Research Inc., 1996

Download: FUNCTION-HIGHESTTIMEAGO.ELA

File Includes: Function - HighestTimeAgo

Description: This indicator will return the Highest Price of the specified time slice prior to the current
time as opposed to the Highest of a specified number of bars prior to the Current Bar.
Inputs:
Price - The Price or Value to be used.
Hours - Number of hours Prior to the current time to be used to calculate the Highest Price.
Minutes - Number of Minutes Prior to the current time to be used to calculate the Highest Price.
Example:
The Highest Price of 1 hour and 15 minutes would require a 1 in HOUR and 15 in MINUTES.

EasyLanguage Code:
INPUT:PRICE(NUMERIC),HOURS(NUMERIC),MINUTES(NUMERIC);

VARS:NEGHOUR(0),NEGMINUT(0);

{ POSITIVE OR NEGATIVE VALUES IN HOURS AND MINUTES WILL BE CONVERTED TO NEGATIVES }
IF CURRENTBAR = 1 THEN BEGIN
NEGHOUR = NEG(HOURS);
NEGMINUT = NEG(MINUTES);
END;

{ FIND THE FIRST BAR OF THAT TIME SLICE AND CALCULATE THE HIGHEST PRICE }
IF (NEGHOUR < 0 AND NEGMINUT < 0) OR
(NEGHOUR = 0 AND NEGMINUT < 0) OR
(NEGHOUR < 0 AND NEGMINUT = 0) THEN BEGIN

IF DATE <> DATE[1] THEN CONDITION1 = FALSE;

VALUE2 = PRICE;

FOR VALUE1 = 0 TO 1440 BEGIN
IF (TIME[VALUE1] >= PROJECTEDTIME(TIME,NEGHOUR,NEGMINUT) AND
PROJECTEDTIME(TIME,NEGHOUR,NEGMINUT) < TIME AND DATE[VALUE1] = DATE) OR
(TIME[VALUE1] <= PROJECTEDTIME(TIME,NEGHOUR,NEGMINUT) AND
PROJECTEDTIME(TIME,NEGHOUR,NEGMINUT) > TIME AND DATE[VALUE1] = DATE) OR
(TIME[VALUE1] >= PROJECTEDTIME(TIME,NEGHOUR,NEGMINUT) AND
PROJECTEDTIME(TIME,NEGHOUR,NEGMINUT) > TIME AND DATE[VALUE1] < DATE)
THEN BEGIN
IF PRICE[VALUE1] > VALUE2 THEN
VALUE2 = PRICE[VALUE1];
END ELSE VALUE1 = 1440;
END;

HIGHESTTIMEAGO = VALUE2;
END;