+1 888 340 6572

HighestUniversal

Article/Author: Emmanuel Lavelanet 1996.

Download: FUNCTION-HIGHESTUNIVERSAL.ELA

File Includes: Function - HighestUniversal

EasyLanguage Code:
INPUTS: TYPE(NUMERICSIMPLE), PRICE(NUMERICSIMPLE),SDATE(NUMERICSIMPLE),STIME(NUMERICSIMPLE);


VARS: HIGHESTPOFDAY(PRICE), HIGHESTPOFWEEK(PRICE), HIGHESTPOFYEAR(PRICE), HIGHESTPFROMPICK(PRICE),
HIGHESTPSOFAR(PRICE);

IF TYPE < 1 OR TYPE > 5 THEN HIGHESTUNIVERSAL = PRICE;

IF TYPE = 1 THEN BEGIN
IF DATE > DATE[1] THEN HIGHESTPOFDAY = PRICE
ELSE HIGHESTPOFDAY = IFF(BARNUMBER > 1 AND
PRICE > HIGHESTPOFDAY , PRICE, HIGHESTPOFDAY );
HIGHESTUNIVERSAL = HIGHESTPOFDAY;
IF DATE = LASTCALCDATE AND TIME = LASTCALCTIME THEN
PRINT("HIGHEST PRICE OF DAY");
END;

IF TYPE = 2 THEN BEGIN
IF DAYOFWEEK(DATE) < DAYOFWEEK(DATE[1]) THEN HIGHESTPOFWEEK = PRICE
ELSE HIGHESTPOFWEEK = IFF(BARNUMBER > 1 AND
PRICE > HIGHESTPOFWEEK , PRICE, HIGHESTPOFWEEK );
HIGHESTUNIVERSAL = HIGHESTPOFWEEK;
IF DATE = LASTCALCDATE AND TIME = LASTCALCTIME THEN
PRINT("HIGHEST PRICE OF WEEK");
END;


IF TYPE = 3 THEN BEGIN
IF YEAR(DATE) > YEAR(DATE[1]) THEN HIGHESTPOFYEAR = PRICE
ELSE HIGHESTPOFYEAR = IFF(BARNUMBER > 1 AND
PRICE > HIGHESTPOFYEAR , PRICE, HIGHESTPOFYEAR );
HIGHESTUNIVERSAL = HIGHESTPOFYEAR;
IF DATE = LASTCALCDATE AND TIME = LASTCALCTIME THEN
PRINT("HIGHEST PRICE OF YEAR");
END;

IF TYPE = 4 THEN BEGIN
IF DATE = SDATE AND (TIME = STIME OR STIME = 0) THEN BEGIN
HIGHESTPFROMPICK = PRICE;
VALUE1 = BARNUMBER;
END;
IF BARNUMBER >= VALUE1 AND VALUE1 > 0 THEN BEGIN
HIGHESTPFROMPICK =
IFF(PRICE > HIGHESTPFROMPICK , PRICE, HIGHESTPFROMPICK );
END ELSE
HIGHESTPFROMPICK = PRICE;
HIGHESTUNIVERSAL = HIGHESTPFROMPICK;

IF DATE = LASTCALCDATE AND TIME = LASTCALCTIME THEN
PRINT("HIGHEST PRICE FROM SELECTED DATE AND TIME");
END;

IF TYPE = 5 THEN BEGIN
IF BARNUMBER = 1 THEN HIGHESTPSOFAR = PRICE
ELSE HIGHESTPSOFAR = IFF(BARNUMBER > 1 AND
PRICE > HIGHESTPSOFAR , PRICE, HIGHESTPSOFAR );
HIGHESTUNIVERSAL = HIGHESTPSOFAR;
IF DATE = LASTCALCDATE AND TIME = LASTCALCTIME THEN
PRINT("HIGHEST PRICE SO FAR");
END;