**Article/Author:**Omega Research Inc., 1996

**Download:**PRICEBASEDUNIVERSAL.ELA

**File Includes:**Indicator - PriceBasedUniversal

**Category:**Indicator > Miscellaneous

**Description:**

This is a special indicator that plots just about anything related to price based on which number of 1 through 13 is passed through the PRICE input. It also contains a DISPLACE input to allow you to displace to the left, any of the plots. It also allows you to put into the PRICE input your own custom formula while still taking advantage of the DISPLACE input.

It means that if you want to look at different aspect of your chart, you do not need to select annother indicator. All you need to do is to change the value in the TYPE input.

You can also add this same indicator several times on the same chart and each time, have it do something different.

**Usage:**

Any of the studies below can be displaced to the left using the optional DISPLACE input.

If you want to displace to the right, type a number within Square Brackets right after your price value within the PRICE input. Example: CLOSE[10].

**Inputs:**

Type:

1 - AVERAGE: PRICE, LENGTH

2 - EXPONENTIAL AVERAGE: PRICE, LENGTH

3 - WEIGHTED AVERAGE: PRICE, LENGTH

4 - SMOOTHED AVERAGE: PRICE, LENGTH

5 - LINEAR REGRESSION VALUE(END POINT AVERAGE): PRICE, LENGTH, MISCELLANEOUS (MISCELLANEOUS IS USED TO PROJECT INTO THE PAST OR INTO THE FUTURE USING A POSITIVE OR NEGATIVE NUMBER )

6 - HGHEST PRICE: PRICE, LENGTH

7 - LOWEST PRICE: PRICE, LENGTH

8 - MID POINT: PRICE, LENGTH ((HIGHEST + LOWEST) / 2)

9 - SWINGHIGH PRICE: PRICE, LENGTH, (MINIMUM LENGTH 1)

10 - SWINGLOW PRICE: PRICE, LENGTH, (MINIMUM LENGTH 1)

11 - WEIGHTED CLOSE: NO INPUT

12 - OPEN/CLOSE MID POINT: NO INPUT

13 - USER CUSTOM FORMULA: PRICE, DISPLACE: THE USER CAN TYPE ANY FORMULA IN THE PRICE INPUT. EXAMPLE: AVERAGE(CLOSE,10)

Price - the data series to use

Length - the trailing number of bars to use

Miscell - see below

Displace - number of bars to shift

**EasyLanguage Code:**

INPUT:TYPE(0),PRICE(CLOSE),LENGTH(10),MISCELL(0),DISPLACE(0);

VALUE1 = 0; VALUE2 = MISCELL;

IF TYPE = 1 THEN BEGIN

VALUE1 = AVERAGE(PRICE,LENGTH);

IF DATE = LASTCALCDATE AND TIME = LASTCALCTIME THEN

PRINT(TYPE:2:0," AVERAGE");

END;

IF TYPE = 2 THEN BEGIN

VALUE1 = XAVERAGE(PRICE,LENGTH);

IF DATE = LASTCALCDATE AND TIME = LASTCALCTIME THEN

PRINT(TYPE:2:0," EXPONENTIAL AVERAGE");

END;

IF TYPE = 3 THEN BEGIN

VALUE1 = WAVERAGE(PRICE,LENGTH);

IF DATE = LASTCALCDATE AND TIME = LASTCALCTIME THEN

PRINT(TYPE:2:0," WEIGHTED AVERAGE");

END;

IF TYPE = 4 THEN BEGIN

VALUE1 = SMOOTHEDAVERAGE(PRICE,LENGTH);

IF DATE = LASTCALCDATE AND TIME = LASTCALCTIME THEN

PRINT(TYPE:2:0," SMOOTHED AVERAGE");

END;

IF TYPE = 5 THEN BEGIN

VALUE1 = LINEARREGVALUE(PRICE,LENGTH,MISCELL);

IF DATE = LASTCALCDATE AND TIME = LASTCALCTIME THEN

PRINT(TYPE:2:0," LINEAR REGRESSION VALUE");

END;

IF TYPE = 6 THEN BEGIN

VALUE1 = HIGHEST(PRICE,LENGTH);

IF DATE = LASTCALCDATE AND TIME = LASTCALCTIME THEN

PRINT(TYPE:2:0," HIGHEST PRICE");

END;

IF TYPE = 7 THEN BEGIN

VALUE1 = LOWEST(PRICE,LENGTH);

IF DATE = LASTCALCDATE AND TIME = LASTCALCTIME THEN

PRINT(TYPE:2:0," LOWEST PRICE");

END;

IF TYPE = 8 THEN BEGIN

VALUE1 = MIDPOINT(PRICE,LENGTH);

IF DATE = LASTCALCDATE AND TIME = LASTCALCTIME THEN

PRINT(TYPE:2:0," MIDPOINT");

END;

IF TYPE = 9 THEN BEGIN

IF SWINGHIGH(1,PRICE,LENGTH,LENGTH + 1) > 0 THEN

VALUE1 = SWINGHIGH(1,PRICE,LENGTH,LENGTH + 1);

IF DATE = LASTCALCDATE AND TIME = LASTCALCTIME THEN

PRINT(TYPE:2:0," SWINGHIGH PRICE");

END;

IF TYPE = 10 THEN BEGIN

IF SWINGLOW(1,PRICE,LENGTH,LENGTH + 1) > 0 THEN

VALUE1 = SWINGLOW(1,PRICE,LENGTH,LENGTH + 1);

IF DATE = LASTCALCDATE AND TIME = LASTCALCTIME THEN

PRINT(TYPE:2:0," SWINGLOW PRICE");

END;

IF TYPE = 11 THEN BEGIN

VALUE1 = WEIGHTEDCLOSE;

IF DATE = LASTCALCDATE AND TIME = LASTCALCTIME THEN

PRINT(TYPE:2:0," WEIGHTED CLOSE");

END;

IF TYPE = 12 THEN BEGIN

VALUE1 = (OPEN + CLOSE) / 2;

IF DATE = LASTCALCDATE AND TIME = LASTCALCTIME THEN

PRINT(TYPE:2:0," OPEN/CLOSE MID POINT");

END;

IF TYPE = 13 THEN BEGIN

VALUE1 = PRICE;

IF DATE = LASTCALCDATE AND TIME = LASTCALCTIME THEN

PRINT(TYPE:2:0," USER CUSTOM");

END;

IF VALUE1 > 0 THEN BEGIN

IF DISPLACE = 0 THEN

PLOT1(VALUE1,"UNIVERSE") ELSE

PLOT1[DISPLACE](VALUE1,"UNIVERSE");

END;