Black Friday great discounts start today Learn more
+1 888 340 6572

Trend Identificator > Mov Avg EnvDisp

Article/Author: Omega Research Inc., 1997

Download: maed.ela

File Includes: Indicator - Mov Avg EnvDisp

Category: Indicator > Trend Identificator

Description:

This indicator plots the Moving Average Displaced Envelopes. This indicator plots 2 moving averages which are calculated using price data from the same number of bars, per the input Length. Moving averages are recognized for their value in identifying trends. Using moving averages of highs and lows, and adjusting them for a fixed percentage, can be helpful in finding extreme conditions of overbought or oversold and in identifying trading ranges.

Usage:

Bands define the upper and lower boundaries of a security's normal trading range. A sell signal is generated when the security reaches the upper band whereas a buy signal is generated at the lower band. The optimum percentage shift depends on the volatility of the security - the more volatile, the larger the percentage.

The logic behind bands is that overzealous buyers and sellers push the price to the extremes (i.e., the upper and lower bands), at which point the prices often stabilize by moving to more realistic levels.




Inputs:

Price - the data series to average
Length - the parameter tells how many bars to average
PrcntAbv - percentage of upward shift
PcntBlw - percentage fo downward shift
Displace - number of bars to displace the plot of the moving average

EasyLanguage Code:
INPUT: PRICE(CLOSE),LENGTH(9),PRCNTABV(.5),PRCNTBLW(.5), DISPLACE(13);

IF DISPLACE>=0 THEN BEGIN
IF CURRENTBAR>DISPLACE THEN BEGIN
PLOT1(AVERAGE(PRICE,LENGTH)[DISPLACE] * (100 + PRCNTABV) / 100,"PRCNTABV");
PLOT2(AVERAGE(PRICE,LENGTH)[DISPLACE] * (100 - PRCNTBLW) / 100,"PRCNTBLW");
END;
END;
IF DISPLACE<0 THEN BEGIN
IF CURRENTBAR>ABSVALUE(DISPLACE) THEN BEGIN
PLOT1[ABSVALUE(DISPLACE)](AVERAGE(PRICE,LENGTH) * (100 + PRCNTABV) / 100,"PRCNTABV");
PLOT2[ABSVALUE(DISPLACE)](AVERAGE(PRICE,LENGTH) * (100 - PRCNTBLW) / 100,"PRCNTBLW");
END;
END;
IF CHECKALERT THEN BEGIN
IF (TRUEHIGH >= PLOT1 AND TRUELOW <= PLOT1)
OR (TRUEHIGH >= PLOT2 AND TRUELOW <= PLOT2)
THEN ALERT = TRUE;
END;