EVOLUTION-MANAGER
Edit File: MACD.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: MACD Oscillator</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for MACD {TTR}"><tr><td>MACD {TTR}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>MACD Oscillator</h2> <h3>Description</h3> <p>The MACD was developed by Gerald Appel and is probably the most popular price oscillator. The MACD function documented in this page compares a fast moving average (MA) of a series with a slow MA of the same series. It can be used as a generic oscillator for any univariate series, not only price. </p> <h3>Usage</h3> <pre> MACD(x, nFast = 12, nSlow = 26, nSig = 9, maType, percent = TRUE, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>Object that is coercible to xts or matrix; usually price, but can be volume, etc.</p> </td></tr> <tr valign="top"><td><code>nFast</code></td> <td> <p>Number of periods for fast moving average.</p> </td></tr> <tr valign="top"><td><code>nSlow</code></td> <td> <p>Number of periods for slow moving average.</p> </td></tr> <tr valign="top"><td><code>nSig</code></td> <td> <p>Number of periods for signal moving average.</p> </td></tr> <tr valign="top"><td><code>maType</code></td> <td> <p>Either: </p> <ol> <li><p> A function or a string naming the function to be called. </p> </li> <li><p> A <em>list</em> with the first component like (1) above, and additional parameters specified as <em>named</em> components. See Examples. </p> </li></ol> </td></tr> <tr valign="top"><td><code>percent</code></td> <td> <p>logical; if <code>TRUE</code>, the percentage difference between the fast and slow moving averages is returned, otherwise the difference between the respective averages is returned.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Other arguments to be passed to the <code>maType</code> function in case (1) above.</p> </td></tr> </table> <h3>Details</h3> <p>The MACD function either subtracts the fast MA from the slow MA, or finds the rate of change between the fast MA and the slow MA. </p> <h3>Value</h3> <p>A object of the same class as <code>x</code> or a matrix (if <code>try.xts</code> fails) containing the columns: </p> <dl> <dt> macd </dt><dd><p> The price (volume, etc.) oscillator. </p> </dd> <dt> signal </dt><dd><p> The oscillator signal line (a moving average of the oscillator). </p> </dd> </dl> <h3>Note</h3> <p>The MACD is a special case of the general oscillator applied to price. The MACD can be used as a general oscillator applied to any series. Time periods for the MACD are often given as 26 and 12, but the original formula used exponential constants of 0.075 and 0.15, which are closer to 25.6667 and 12.3333 periods. </p> <h3>Author(s)</h3> <p>Joshua Ulrich </p> <h3>References</h3> <p>The following site(s) were used to code/document this indicator: <br /> Moving Average Convergence/Divergence (MACD):<br /> <a href="https://www.fmlabs.com/reference/MACD.htm">https://www.fmlabs.com/reference/MACD.htm</a><br /> <a href="https://www.metastock.com/Customer/Resources/TAAZ/?p=66">https://www.metastock.com/Customer/Resources/TAAZ/?p=66</a><br /> <a href="https://www.linnsoft.com/techind/macd">https://www.linnsoft.com/techind/macd</a><br /> <a href="https://school.stockcharts.com/doku.php?id=technical_indicators:moving_average_convergence_divergence_macd">https://school.stockcharts.com/doku.php?id=technical_indicators:moving_average_convergence_divergence_macd</a><br /> <br /> Price Oscillator:<br /> <a href="https://www.fmlabs.com/reference/PriceOscillator.htm">https://www.fmlabs.com/reference/PriceOscillator.htm</a><br /> <a href="https://www.fmlabs.com/reference/PriceOscillatorPct.htm">https://www.fmlabs.com/reference/PriceOscillatorPct.htm</a><br /> <a href="https://www.metastock.com/Customer/Resources/TAAZ/?p=94">https://www.metastock.com/Customer/Resources/TAAZ/?p=94</a><br /> <a href="https://school.stockcharts.com/doku.php?id=technical_indicators:price_oscillators_ppo">https://school.stockcharts.com/doku.php?id=technical_indicators:price_oscillators_ppo</a><br /> <br /> Volume Oscillator:<br /> <a href="https://www.fmlabs.com/reference/PVO.htm">https://www.fmlabs.com/reference/PVO.htm</a><br /> <a href="https://www.metastock.com/Customer/Resources/TAAZ/?p=122">https://www.metastock.com/Customer/Resources/TAAZ/?p=122</a><br /> </p> <h3>See Also</h3> <p>See <code><a href="MovingAverages.html">EMA</a></code>, <code><a href="MovingAverages.html">SMA</a></code>, etc. for moving average options; and note Warning section. </p> <h3>Examples</h3> <pre> data(ttrc) macd <- MACD( ttrc[,"Close"], 12, 26, 9, maType="EMA" ) macd2 <- MACD( ttrc[,"Close"], 12, 26, 9, maType=list(list(SMA), list(EMA, wilder=TRUE), list(SMA)) ) </pre> <hr /><div style="text-align: center;">[Package <em>TTR</em> version 0.24.3 <a href="00Index.html">Index</a>]</div> </body></html>