+1 888 340 6572 GET STARTED

Averages > Mov Avg 1 line

Article/Author: Omega Research Inc., 1997

Download: MOV1.ELA

Category: Indicator > Averages

Description:

The moving average may be the most widely used indicator. The Mov Avg 1 line indicator calculates and plots a simple arithmetic average of prices, specified by the input Price, from each of the most recent number of bars specified by the input Length.

Usage:

A moving average is generally used for trend identification. Attention is given to the direction in which the average is moving and to the relative position of prices and the moving average. Rising moving average values (direction) and prices above the moving average (position) would indicate an uptrend. Declining moving average values and prices below the moving average would indicate a downtrend. A displaced moving average plots the moving average value of a previous bar or later bar on the current bar.




Inputs:

Price - Value to be used in calculating the Moving Average
Length - Number of bars of data to be included in calculation
Displace - Number of bars to displace the plot of the Moving Average

EasyLanguage Code:
INPUTS: PRICE(CLOSE), LENGTH(9), DISPLACE(0);


IF DISPLACE >= 0 OR CURRENTBAR > ABSVALUE(DISPLACE) THEN BEGIN
PLOT1[DISPLACE](AVERAGEFC(PRICE, LENGTH), "SIMPAVG1");

{ALERT CRITERIA}
IF PRICE < PLOT1 AND PLOT1 < PLOT1[1] AND PLOT1[1] > PLOT1[2] THEN
ALERT("THE MOVING AVERAGE HAS JUST CHANGED DIRECTION AND IS NOW BULLISH")
ELSE
IF PRICE > PLOT1 AND PLOT1 > PLOT1[1] AND PLOT1[1] < PLOT1[2] THEN
ALERT("THE MOVING AVERAGE HAS JUST CHANGED DIRECTION AND IS NOW BEARISH");

END;