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

Averages > Mov Avg X 2/20

Article/Author: Stocks&Commodities Magazine, Traders Tips, 12/1996

Download: IndMA2-20.ela

File Includes: Indicator - Mov Avg X 2/20

Category: Indicator > Averages

Description: For the Mov Avg X 2/20 Indicator, the EMA bar will be painted when the Alert criteria is met.

Usage:

The most popular method of interpreting a moving average is to compare the relationship between a moving average of the security's price with the security's price itself (or between several moving averages).




Inputs:

Price - the data series to average
AvgLen - the parameter tells how many bars to average

EasyLanguage Code:
INPUTS: PRICE(CLOSE), AVGLEN(20);

VARS: AVGVAL(0);

AVGVAL = XAVERAGE(PRICE, AVGLEN);
PLOT1(AVGVAL, "MOVAVG");

{ENTRY ALERT CRITERIA}
IF (LOWEST(LOW, 2) > AVGVAL AND LOW 1 BAR AGO CROSSES ABOVE AVGVAL 1 BAR AGO)
OR (HIGHEST(HIGH, 2) < AVGVAL AND HIGH 1 BAR AGO CROSSES BELOW AVGVAL 1 BAR AGO)
THEN BEGIN
IF CHECKALERT THEN ALERT = TRUE;
PLOT2(HIGH, "ALERT");
PLOT3(LOW, "ALERT");
END;