The function returns the difference between a fast and slow moving average based on the same PRICE. Category:
Easy Language
Function:
MACD(PRICE,FASTMA,SLOWMA)
Parameters:
PRICE specifies which price of the asset of interest is to be used FASTMA number of trailing bars to consider for the fast average SLOWMA number of trailing bars to consider for the slow average
Returns:
The MACD value for the current bar
Usage:
When the function is used in a study or system, PRICE, FASTMA, and SLOWMA can either be hard coded or replaced with a variable. The parameter PRICE is usually hard coded with some bar attribute such as Close, Open, Low, Low, and Volume, or is replaced with a numeric series type input. However, it can be replaced with a valid Easy Language expression such as Close + Open or Average(RSI(Close,14),14). FASTMA and SLOWMA refer to the number of bars used in the moving averages. Therefore, if hard coded, the value used to replace these two parameters should be a whole number and cannot change on a bar-by-bar basis. FASTMA is supposed to be less than SLOWMA. If the specified length of FASTMA is greater than that of the SLOWMA, the oscillator will invert.
During rising markets, the fast period moving average will rise faster than the slow period moving average resulting in a rising differential line or a larger value. The idea is that with a smaller number of bars used in its calculation, the fast period moving average, will more quickly indicate the trend of the most recent data. When the fast period moving average crosses above or crosses below the slow period moving average, a signal is generated. Once the lines cross, it becomes important to look at the distance between them. The MACD function returns that difference. When the fast period moving average is above the slow period moving average, the MACD is positive and when it is below the slow period moving average the MACD is negative.
Reference:
Gerald Appel, Signalert Corporation, 150 Great Neck Road, Great Neck, NY 11021 |