+1 888 340 6572

LowestTimeAgo

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

Download: FUNCTION-LOWESTTIMEAGO.ELA

File Includes: Function - LowestTimeAgo

Description: This indicator will return the Lowest Price of the specified time slice prior to the current
time as opposed to the Lowest 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 Lowest Price.
Minutes - Number of Minutes Prior to the current time to be used to calculate the Lowest 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);

IF CURRENTBAR = 1 THEN BEGIN
NEGHOUR = NEG(HOURS);
NEGMINUT = NEG(MINUTES);
END;

{ FIND THE FIRST BAR OF THAT TIME SLICE AND CALCULATE THE LOWEST 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;

LOWESTTIMEAGO = VALUE2;
END;