MultiCharts Easter Sale has jumped in! Up to 50% off Explore offers
+1 888 340 6572 GET STARTED

Averages > Mov Avg Weighted

Article/Author: Omega Research Inc., 1997

Download: MAWEIGHTED.ELA

Category: Indicator > Averages

Description:

The moving average may be the most widely used indicator. The Mov Avg Weighted indicator calculates and plots a weighted average of prices, specified by the Price input, from each of the most recent number of bars specified by the Length input. This method of calculating a Moving Average gives greater weight to the market’s most recent price and a reduced weighting to older prices. (A simple moving average gives equal weight to all the prices in the series.)

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 Weighted Moving Average
Length - Number of bars of data to be included in calculation
Displace - Number of bars to displace the plot of the Weighted Moving Average

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


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

{ALERT CRITERIA}
IF PRICE < PLOT1 AND PLOT1 < PLOT1[1] AND PLOT1[1] > PLOT1[2] THEN
ALERT("THE WEIGHTED 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 WEIGHTED MOVING AVERAGE HAS JUST CHANGED DIRECTION AND IS NOW BEARISH");


END;